From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com> |
Cc: | Magnus Hagander <magnus(at)hagander(dot)net>, sk(at)zsrv(dot)org, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Robert Haas <robertmhaas(at)gmail(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Euler Taveira <euler(at)timbira(dot)com(dot)br>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Dave Page <dpage(at)pgadmin(dot)org> |
Subject: | Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query |
Date: | 2018-11-17 03:36:20 |
Message-ID: | CAA4eK1J3QVi9Q_tgZiN9Fua00kTA-h+0Osjj5HbsdzVDHH1F2g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Nov 17, 2018 at 4:47 AM Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com> wrote:
>
> With the above query to get the queryid, but there are no such queries
> present in the pg_stat_statements, so the above query returns NULL as
> output, and with NULL as input to the _reset() function, it takes the default
> value of 0, and the reset query compares with rest of the two parameters
> of userid and dbid. There is only one query that is present with that
> combination, and that query is deleted.
>
> In order to avoid such wrong results, i moved this as the first reset query,
> so that there will be many queries that satisfy the condition in case if such
> mistakes happens.
>
Okay, that makes sense.
+--
+-- remove query ('SELECT $1 AS "ONE"') executed by two users
+--
+SELECT pg_stat_statements_reset(NULL,NULL,s.queryid)
+ FROM pg_stat_statements AS s WHERE s.query = 'SELECT $1 AS "ONE"' LIMIT 1;
In the above query, I don't see any advantage of adding LIMIT 1, so
removed in the attached patch. I have also written a commit message
based on what you have written, kindly see if that looks okay to you
especially the credits section.
I am happy with the attached patch and will commit the same by
Wednesday if you or others don't have any further comments.
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
0001-pg_stat_statements_reset-to-reset-specific-query-use_v13.patch | application/octet-stream | 20.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2018-11-17 05:20:46 | Re: zheap: a new storage format for PostgreSQL |
Previous Message | Stephen Frost | 2018-11-17 02:12:39 | Re: Early WIP/PoC for inlining CTEs |