Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2019-01-10 Thread Amit Kapila
On Thu, Jan 10, 2019 at 12:11 PM Haribabu Kommi wrote: > On Thu, Jan 10, 2019 at 2:32 PM Amit Kapila wrote: >> >> I am happy with this patch now, attached is the new version of the >> patch where I have slightly modified the commit message, see if that >> looks fine to you. I will push this patc

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2019-01-09 Thread Haribabu Kommi
On Thu, Jan 10, 2019 at 2:32 PM Amit Kapila wrote: > On Wed, Jan 9, 2019 at 10:26 AM Haribabu Kommi > wrote: > > > > > > On Wed, Jan 9, 2019 at 2:25 PM Amit Kapila > wrote: > >> > >> Another minor point is that in the second statement > >> (pg_stat_statements_reset), you seem to have made it a

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2019-01-09 Thread Amit Kapila
On Wed, Jan 9, 2019 at 10:26 AM Haribabu Kommi wrote: > > > On Wed, Jan 9, 2019 at 2:25 PM Amit Kapila wrote: >> >> Another minor point is that in the second statement >> (pg_stat_statements_reset), you seem to have made it a two-line >> statement whereas first one looks to be a single-line state

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2019-01-08 Thread Haribabu Kommi
On Wed, Jan 9, 2019 at 2:25 PM Amit Kapila wrote: > Few minor comments: > Thanks for the review. > 1. > bench=# SELECT query, calls, total_time, rows, 100.0 * shared_blks_hit / >nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent > FROM pg_stat_statements ORD

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2019-01-08 Thread Amit Kapila
On Tue, Jan 8, 2019 at 6:00 AM Haribabu Kommi wrote: > > On Tue, Dec 18, 2018 at 3:53 PM Amit Kapila wrote: >> >> Can you add a few examples in the documentation? See if it is >> possible to extend the existing documentation section (F.29.4), >> otherwise, add a new section. > > > Apologies for

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2019-01-07 Thread Haribabu Kommi
On Tue, Dec 18, 2018 at 3:53 PM Amit Kapila wrote: > On Wed, Dec 12, 2018 at 3:54 PM Haribabu Kommi > wrote: > > > > On Thu, Nov 29, 2018 at 1:57 PM Amit Kapila > wrote: > >> > > >> > >> Agreed. Hari, can you change the patch as per the requirements of > option-4. > > > > > > Apologies for del

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-19 Thread Alvaro Herrera
On 2018-Dec-17, Kyotaro HORIGUCHI wrote: > Although #1 seems cleaner to me, the fear of inadvertent removal > of all queries with quite-common usage wins. So I vote for #4 > for now, supposing pg_stat_statements_reset(0, 0, 0) as > all-clear. Right -- also keeping in mind that 0 is the default v

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-18 Thread Amit Kapila
On Sat, Dec 15, 2018 at 12:14 AM Robert Haas wrote: > > On Wed, Nov 28, 2018 at 1:43 PM Alvaro Herrera > wrote: > > Right, I think option 4 is a clear improvement over option 1. I can get > > behind that one. Since not many people care to vote, I think this tips > > the scales enough to that s

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-17 Thread Amit Kapila
On Wed, Dec 12, 2018 at 3:54 PM Haribabu Kommi wrote: > > On Thu, Nov 29, 2018 at 1:57 PM Amit Kapila wrote: >> > >> >> Agreed. Hari, can you change the patch as per the requirements of option-4. > > > Apologies for delay. Thanks to all your opinions. > > Attached is the updated patch as per the

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-17 Thread Kyotaro HORIGUCHI
Hello. One more weight comes here. At Sat, 15 Dec 2018 08:03:46 +0530, Amit Kapila wrote in > On Sat, Dec 15, 2018 at 12:14 AM Robert Haas wrote: > > > > On Wed, Nov 28, 2018 at 1:43 PM Alvaro Herrera > > wrote: > > > Right, I think option 4 is a clear improvement over option 1. I can get >

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-16 Thread Alvaro Herrera
On 2018-Dec-15, Peter Eisentraut wrote: > An example: > > select pg_stat_statements_reset( > 10, > (select min(oid) from pg_database where datname like 'test%'), > 1234); > > (This is obviously a weird example, but it illustrates the > language-theoretic point.) This is not at all weird. Lack

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-15 Thread Peter Eisentraut
On 14/12/2018 19:44, Robert Haas wrote: > I'm showing up very late to the party here, but I like option 1 best. > I feel like the SQL standard has a pretty clear idea that NULL is how > you represent a value is unknown, which shows up in a lot of places. > Deciding that we're going to use a differe

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-14 Thread Amit Kapila
On Sat, Dec 15, 2018 at 12:14 AM Robert Haas wrote: > > On Wed, Nov 28, 2018 at 1:43 PM Alvaro Herrera > wrote: > > Right, I think option 4 is a clear improvement over option 1. I can get > > behind that one. Since not many people care to vote, I think this tips > > the scales enough to that s

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-14 Thread Robert Haas
On Wed, Nov 28, 2018 at 1:43 PM Alvaro Herrera wrote: > Right, I think option 4 is a clear improvement over option 1. I can get > behind that one. Since not many people care to vote, I think this tips > the scales enough to that side. I'm showing up very late to the party here, but I like optio

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-12 Thread Amit Kapila
On Wed, Dec 12, 2018 at 3:54 PM Haribabu Kommi wrote: > > > On Thu, Nov 29, 2018 at 1:57 PM Amit Kapila wrote: >> >> On Wed, Nov 28, 2018 at 7:13 PM Alvaro Herrera >> wrote: >> > >> > On 2018-Nov-28, Amit Kapila wrote: >> > >> > > The problem with this idea is that if someone specifies a partic

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-12-12 Thread Haribabu Kommi
On Thu, Nov 29, 2018 at 1:57 PM Amit Kapila wrote: > On Wed, Nov 28, 2018 at 7:13 PM Alvaro Herrera > wrote: > > > > On 2018-Nov-28, Amit Kapila wrote: > > > > > The problem with this idea is that if someone specifies a particular > > > parameter using query and the query doesn't return any para

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-30 Thread Peter Eisentraut
On 28/11/2018 14:43, Alvaro Herrera wrote: > On 2018-Nov-28, Amit Kapila wrote: > >> The problem with this idea is that if someone specifies a particular >> parameter using query and the query doesn't return any parameters, >> then it can lead to inadvertent behavior. For example, if user uses >>

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-28 Thread Michael Paquier
On Thu, Nov 29, 2018 at 09:09:48AM +0530, Amit Kapila wrote: > On Thu, Nov 29, 2018 at 8:46 AM Michael Paquier wrote: >> With option 4 (as defined in [1]), the database ID or the user ID set to >> 0 means that we don't apply any filter on them, which is sensible. Now, >> we have query IDs which c

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-28 Thread Amit Kapila
On Thu, Nov 29, 2018 at 8:46 AM Michael Paquier wrote: > > On Wed, Nov 28, 2018 at 10:43:35AM -0300, Alvaro Herrera wrote: > > On 2018-Nov-28, Amit Kapila wrote: > >> The problem with this idea is that if someone specifies a particular > >> parameter using query and the query doesn't return any pa

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-28 Thread Michael Paquier
On Wed, Nov 28, 2018 at 10:43:35AM -0300, Alvaro Herrera wrote: > On 2018-Nov-28, Amit Kapila wrote: >> The problem with this idea is that if someone specifies a particular >> parameter using query and the query doesn't return any parameters, >> then it can lead to inadvertent behavior. For exampl

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-28 Thread Amit Kapila
On Wed, Nov 28, 2018 at 7:13 PM Alvaro Herrera wrote: > > On 2018-Nov-28, Amit Kapila wrote: > > > The problem with this idea is that if someone specifies a particular > > parameter using query and the query doesn't return any parameters, > > then it can lead to inadvertent behavior. For example,

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-28 Thread Alvaro Herrera
On 2018-Nov-28, Amit Kapila wrote: > The problem with this idea is that if someone specifies a particular > parameter using query and the query doesn't return any parameters, > then it can lead to inadvertent behavior. For example, if user uses > something like pg_stat_statements_reset(, > , SELE

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-28 Thread Amit Kapila
On Wed, Nov 28, 2018 at 4:45 PM Sergei Kornilov wrote: > > Hello > > > My preference is for NULL to mean *all* so this is my favorite option, > > except that the first query should reset everything. > > I am +1 for this option. NULL treat as "any" and > pg_stat_statements_reset(NULL,NULL,NULL) to

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-28 Thread Sergei Kornilov
Hello > My preference is for NULL to mean *all* so this is my favorite option, > except that the first query should reset everything. I am +1 for this option. NULL treat as "any" and pg_stat_statements_reset(NULL,NULL,NULL) to reset everything We can use named notation? https://www.postgresql.

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-27 Thread Amit Kapila
On Mon, Nov 26, 2018 at 5:40 PM Vik Fearing wrote: > > On 23/11/2018 00:09, Haribabu Kommi wrote: > > > > On Fri, Nov 23, 2018 at 1:54 AM Peter Eisentraut > > > > wrote: > > > > On 19/11/2018 06:18, Haribabu Kommi wrote: > > > Amit suggested anothe

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-26 Thread Vik Fearing
On 23/11/2018 00:09, Haribabu Kommi wrote: > > On Fri, Nov 23, 2018 at 1:54 AM Peter Eisentraut > > wrote: > > On 19/11/2018 06:18, Haribabu Kommi wrote: > > Amit suggested another option in another mail, so total viable  > > solutions that ar

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-26 Thread Amit Kapila
On Fri, Nov 23, 2018 at 4:40 AM Haribabu Kommi wrote: > > > On Fri, Nov 23, 2018 at 1:54 AM Peter Eisentraut > wrote: >> >> On 19/11/2018 06:18, Haribabu Kommi wrote: >> > Amit suggested another option in another mail, so total viable >> > solutions that are discussed as of now are, >> > >> > 1.

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-26 Thread Amit Kapila
On Thu, Nov 22, 2018 at 7:51 PM Amit Kapila wrote: > > On Thu, Nov 22, 2018 at 7:48 PM Amit Kapila wrote: > > > > On Thu, Nov 22, 2018 at 7:02 PM Alvaro Herrera > > wrote: > > > > > > On 2018-Nov-20, Haribabu Kommi wrote: > > > > > > > > > 4. Single API with -1 as invalid value, treat NULL as n

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Haribabu Kommi
On Fri, Nov 23, 2018 at 1:54 AM Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 19/11/2018 06:18, Haribabu Kommi wrote: > > Amit suggested another option in another mail, so total viable > > solutions that are discussed as of now are, > > > > 1. Single API with NULL input treat as

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Peter Eisentraut
On 19/11/2018 06:18, Haribabu Kommi wrote: > Amit suggested another option in another mail, so total viable  > solutions that are discussed as of now are, > > 1. Single API with NULL input treat as invalid value > 2. Multiple API to deal with NULL input of other values > 3. Single API with NULL va

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Amit Kapila
On Thu, Nov 22, 2018 at 7:48 PM Amit Kapila wrote: > > On Thu, Nov 22, 2018 at 7:02 PM Alvaro Herrera > wrote: > > > > On 2018-Nov-20, Haribabu Kommi wrote: > > > > > > > 4. Single API with -1 as invalid value, treat NULL as no matching. > > > > > (Only > > > > problem > > > > > with this appr

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Amit Kapila
On Thu, Nov 22, 2018 at 7:02 PM Alvaro Herrera wrote: > > On 2018-Nov-20, Haribabu Kommi wrote: > > > > > 4. Single API with -1 as invalid value, treat NULL as no matching. (Only > > > problem > > > > with this approach is till now -1 is also a valid queryid, but setting > > > -1 as queryid > > >

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Alvaro Herrera
On 2018-Nov-20, Haribabu Kommi wrote: > > > 4. Single API with -1 as invalid value, treat NULL as no matching. (Only > > problem > > > with this approach is till now -1 is also a valid queryid, but setting > > -1 as queryid > > > needs to be avoided. > > > > Hmm, can we use 0 as default value wit

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-22 Thread Magnus Hagander
On Thu, Nov 22, 2018 at 4:10 AM Amit Kapila wrote: > On Mon, Nov 19, 2018 at 10:48 AM Haribabu Kommi > wrote: > > > > On Mon, Nov 19, 2018 at 1:37 PM Alvaro Herrera > wrote: > >> > >> On 2018-Nov-19, Michael Paquier wrote: > >> > >> > On Mon, Nov 19, 2018 at 10:41:22AM +1100, Haribabu Kommi wro

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-21 Thread Amit Kapila
On Mon, Nov 19, 2018 at 10:48 AM Haribabu Kommi wrote: > > On Mon, Nov 19, 2018 at 1:37 PM Alvaro Herrera > wrote: >> >> On 2018-Nov-19, Michael Paquier wrote: >> >> > On Mon, Nov 19, 2018 at 10:41:22AM +1100, Haribabu Kommi wrote: >> > > So 6 new functions needs to be added to cover all the abo

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-19 Thread Amit Kapila
On Tue, Nov 20, 2018 at 10:56 AM Haribabu Kommi wrote: > > On Tue, Nov 20, 2018 at 2:06 PM Amit Kapila wrote: >> >> On Mon, Nov 19, 2018 at 10:48 AM Haribabu Kommi >> wrote: >> > On Mon, Nov 19, 2018 at 1:37 PM Alvaro Herrera >> > wrote: >> >> >> >> On 2018-Nov-19, Michael Paquier wrote: >> >>

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-19 Thread Haribabu Kommi
On Tue, Nov 20, 2018 at 2:06 PM Amit Kapila wrote: > On Mon, Nov 19, 2018 at 10:48 AM Haribabu Kommi > wrote: > > On Mon, Nov 19, 2018 at 1:37 PM Alvaro Herrera > wrote: > >> > >> On 2018-Nov-19, Michael Paquier wrote: > >> > >> > On Mon, Nov 19, 2018 at 10:41:22AM +1100, Haribabu Kommi wrote:

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-19 Thread Amit Kapila
On Mon, Nov 19, 2018 at 10:48 AM Haribabu Kommi wrote: > On Mon, Nov 19, 2018 at 1:37 PM Alvaro Herrera > wrote: >> >> On 2018-Nov-19, Michael Paquier wrote: >> >> > On Mon, Nov 19, 2018 at 10:41:22AM +1100, Haribabu Kommi wrote: >> > > So 6 new functions needs to be added to cover all the above

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-18 Thread Haribabu Kommi
On Mon, Nov 19, 2018 at 1:37 PM Alvaro Herrera wrote: > On 2018-Nov-19, Michael Paquier wrote: > > > On Mon, Nov 19, 2018 at 10:41:22AM +1100, Haribabu Kommi wrote: > > > So 6 new functions needs to be added to cover all the above cases, > > > IMO, we may need functions for all combinations, beca

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-18 Thread Amit Kapila
On Sat, Nov 17, 2018 at 7:41 PM Alvaro Herrera wrote: > > On 2018-Nov-17, Amit Kapila wrote: > > > On Sat, Nov 17, 2018 at 4:46 PM Alvaro Herrera > > wrote: > > > > Uh, ouch! Seems to me that this is a high-caliber foot-gun, and will > > > cause nasty suprises when production stats data disappe

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-18 Thread Alvaro Herrera
On 2018-Nov-19, Michael Paquier wrote: > On Mon, Nov 19, 2018 at 10:41:22AM +1100, Haribabu Kommi wrote: > > So 6 new functions needs to be added to cover all the above cases, > > IMO, we may need functions for all combinations, because I feel some > > user may have the requirement of left out com

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-18 Thread Michael Paquier
On Mon, Nov 19, 2018 at 10:41:22AM +1100, Haribabu Kommi wrote: > So 6 new functions needs to be added to cover all the above cases, > IMO, we may need functions for all combinations, because I feel some > user may have the requirement of left out combination, in case if we choose > only some combi

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-18 Thread Haribabu Kommi
On Sun, Nov 18, 2018 at 1:11 AM Alvaro Herrera wrote: > On 2018-Nov-17, Amit Kapila wrote: > > > On Sat, Nov 17, 2018 at 4:46 PM Alvaro Herrera > wrote: > > > > Uh, ouch! Seems to me that this is a high-caliber foot-gun, and will > > > cause nasty suprises when production stats data disappear >

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-17 Thread Alvaro Herrera
On 2018-Nov-17, Amit Kapila wrote: > On Sat, Nov 17, 2018 at 4:46 PM Alvaro Herrera > wrote: > > Uh, ouch! Seems to me that this is a high-caliber foot-gun, and will > > cause nasty suprises when production stats data disappear inadvertently! > > What is the alternative in your mind? Well, a

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-17 Thread Amit Kapila
On Sat, Nov 17, 2018 at 4:46 PM Alvaro Herrera wrote: > > On 2018-Nov-17, Haribabu Kommi wrote: > > > > Okay, but you haven't answered my question: > > > "how is able to remove the correct statement from hash (it seems > > > statement intended to remove 'SELECT $1 AS "ONE"', but it removed > > > '

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-17 Thread Alvaro Herrera
On 2018-Nov-17, Haribabu Kommi wrote: > > Okay, but you haven't answered my question: > > "how is able to remove the correct statement from hash (it seems > > statement intended to remove 'SELECT $1 AS "ONE"', but it removed > > 'SELECT $1 + $2 AS "TWO"')"? > > I missed to check that question. >

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-16 Thread Amit Kapila
On Sat, Nov 17, 2018 at 4:47 AM Haribabu Kommi 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

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-16 Thread Haribabu Kommi
On Fri, Nov 16, 2018 at 11:00 PM Amit Kapila wrote: > On Fri, Nov 16, 2018 at 9:43 AM Haribabu Kommi > wrote: > > > > On Thu, Nov 15, 2018 at 5:18 PM Amit Kapila > wrote: > >> > >> > +-- > >> > +-- remove query ('SELECT $1 + $2 AS "TWO"') executed by > >> > regress_stats_user2 in the current_da

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-16 Thread Amit Kapila
On Fri, Nov 16, 2018 at 9:43 AM Haribabu Kommi wrote: > > On Thu, Nov 15, 2018 at 5:18 PM Amit Kapila wrote: >> >> > +-- >> > +-- remove query ('SELECT $1 + $2 AS "TWO"') executed by >> > regress_stats_user2 in the current_database >> > +-- >> > +SELECT pg_stat_statements_reset((SELECT r.oid FROM

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-15 Thread Haribabu Kommi
On Thu, Nov 15, 2018 at 5:18 PM Amit Kapila wrote: > On Thu, Nov 15, 2018 at 11:38 AM Amit Kapila > wrote: > > > > On Thu, Nov 15, 2018 at 2:05 AM Haribabu Kommi > wrote: > > > > > > On Wed, Nov 14, 2018 at 8:45 PM Amit Kapila > wrote: > > >> Apart from the above, I think we should add a test

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-14 Thread Amit Kapila
On Thu, Nov 15, 2018 at 11:38 AM Amit Kapila wrote: > > On Thu, Nov 15, 2018 at 2:05 AM Haribabu Kommi > wrote: > > > > On Wed, Nov 14, 2018 at 8:45 PM Amit Kapila wrote: > >> Apart from the above, I think we should add a test where all the > >> parameters are valid as the corresponding code is

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-14 Thread Amit Kapila
On Thu, Nov 15, 2018 at 2:05 AM Haribabu Kommi wrote: > > On Wed, Nov 14, 2018 at 8:45 PM Amit Kapila wrote: >> Apart from the above, I think we should add a test where all the >> parameters are valid as the corresponding code is not covered by any >> existing tests. > > > Added another test with

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-14 Thread Haribabu Kommi
On Wed, Nov 14, 2018 at 8:45 PM Amit Kapila wrote: > On Wed, Nov 14, 2018 at 7:04 AM Haribabu Kommi > wrote: > > > > On Wed, Nov 14, 2018 at 12:26 AM Amit Kapila > wrote: > >> > >> On Tue, Nov 13, 2018 at 11:32 AM Haribabu Kommi > >> wrote: > >> > > >> > On Mon, Nov 12, 2018 at 6:34 PM Amit Ka

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-14 Thread Amit Kapila
On Wed, Nov 14, 2018 at 7:04 AM Haribabu Kommi wrote: > > On Wed, Nov 14, 2018 at 12:26 AM Amit Kapila wrote: >> >> On Tue, Nov 13, 2018 at 11:32 AM Haribabu Kommi >> wrote: >> > >> > On Mon, Nov 12, 2018 at 6:34 PM Amit Kapila >> > wrote: >> >> > I can revert it back to void, >> >> > >> >> >>

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-13 Thread Haribabu Kommi
On Wed, Nov 14, 2018 at 12:26 AM Amit Kapila wrote: > On Tue, Nov 13, 2018 at 11:32 AM Haribabu Kommi > wrote: > > > > On Mon, Nov 12, 2018 at 6:34 PM Amit Kapila > wrote: > >> > I can revert it back to void, > >> > > >> > >> +1, as we don't see any good reason to break backward compatibility.

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-13 Thread Amit Kapila
On Tue, Nov 13, 2018 at 11:32 AM Haribabu Kommi wrote: > > On Mon, Nov 12, 2018 at 6:34 PM Amit Kapila wrote: >> > I can revert it back to void, >> > >> >> +1, as we don't see any good reason to break backward compatibility. > > > Thanks for the review. > Attached the updated patch with return ty

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-12 Thread Haribabu Kommi
On Mon, Nov 12, 2018 at 6:34 PM Amit Kapila wrote: > On Mon, Nov 12, 2018 at 10:55 AM Haribabu Kommi > wrote: > > > > I can revert it back to void, > > > > +1, as we don't see any good reason to break backward compatibility. > Thanks for the review. Attached the updated patch with return type a

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-11 Thread Amit Kapila
On Mon, Nov 12, 2018 at 10:55 AM Haribabu Kommi wrote: > > On Fri, Nov 9, 2018 at 2:12 PM Amit Kapila wrote: >> >> On Thu, Nov 8, 2018 at 10:56 PM Magnus Hagander wrote: >> > >> > On Thu, Nov 8, 2018 at 3:53 PM Sergei Kornilov wrote: >> >> >> >> Hi >> >> >> >> >> Sure, but what are we going to

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-11 Thread Haribabu Kommi
On Fri, Nov 9, 2018 at 2:12 PM Amit Kapila wrote: > On Thu, Nov 8, 2018 at 10:56 PM Magnus Hagander > wrote: > > > > On Thu, Nov 8, 2018 at 3:53 PM Sergei Kornilov wrote: > >> > >> Hi > >> > >> >> Sure, but what are we going to achieve with that number? What > >> >> information user is going

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-08 Thread Amit Kapila
On Thu, Nov 8, 2018 at 10:56 PM Magnus Hagander wrote: > > On Thu, Nov 8, 2018 at 3:53 PM Sergei Kornilov wrote: >> >> Hi >> >> >> Sure, but what are we going to achieve with that number? What >> >> information user is going to get by that? If it can help us to ensure >> >> that it has reset t

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-08 Thread Magnus Hagander
On Thu, Nov 8, 2018 at 3:53 PM Sergei Kornilov wrote: > Hi > > >> Sure, but what are we going to achieve with that number? What > >> information user is going to get by that? If it can help us to ensure > >> that it has reset the expected number of statements, then I can see > >> the clear us

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-08 Thread Sergei Kornilov
Hi >>  Sure, but what are we going to achieve with that number? What >>  information user is going to get by that? If it can help us to ensure >>  that it has reset the expected number of statements, then I can see >>  the clear usage, but without that, the return value doesn't seem to >>  have an

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-08 Thread Alvaro Herrera
On 2018-Nov-08, Amit Kapila wrote: > Sure, but what are we going to achieve with that number? What > information user is going to get by that? If it can help us to ensure > that it has reset the expected number of statements, then I can see > the clear usage, but without that, the return value d

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-08 Thread Amit Kapila
On Thu, Nov 8, 2018 at 1:52 PM Haribabu Kommi wrote: > On Thu, Nov 8, 2018 at 4:53 PM Amit Kapila wrote: >> > This patch has changed the pg_stat_statements_reset() function from >> > returning void >> > to number statements that it reset. >> > >> >> What is the motivation of that change? It see

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-08 Thread Haribabu Kommi
On Thu, Nov 8, 2018 at 4:53 PM Amit Kapila wrote: > On Sun, Nov 4, 2018 at 6:37 AM Haribabu Kommi > wrote: > > > > On Sun, Nov 4, 2018 at 11:17 AM Michael Paquier > wrote: > >> > >> On Sat, Nov 03, 2018 at 03:56:14PM +0530, Amit Kapila wrote: > >> > Before trying out any solution or deciding wh

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-07 Thread Amit Kapila
On Sun, Nov 4, 2018 at 6:37 AM Haribabu Kommi wrote: > > On Sun, Nov 4, 2018 at 11:17 AM Michael Paquier wrote: >> >> On Sat, Nov 03, 2018 at 03:56:14PM +0530, Amit Kapila wrote: >> > Before trying out any solution or deciding which is better, I think we >> > want to understand why the variabilit

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-03 Thread Haribabu Kommi
On Sun, Nov 4, 2018 at 11:17 AM Michael Paquier wrote: > On Sat, Nov 03, 2018 at 03:56:14PM +0530, Amit Kapila wrote: > > Before trying out any solution or deciding which is better, I think we > > want to understand why the variability in results occurred only after > > your patch? Without the p

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-03 Thread Michael Paquier
On Sat, Nov 03, 2018 at 03:56:14PM +0530, Amit Kapila wrote: > Before trying out any solution or deciding which is better, I think we > want to understand why the variability in results occurred only after > your patch? Without the patch, it works just fine. Good point. We surely want to have a

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-11-03 Thread Amit Kapila
On Fri, Sep 28, 2018 at 7:45 AM Haribabu Kommi wrote: > > On Tue, Sep 25, 2018 at 3:09 PM Michael Paquier wrote: >> >> On Tue, Sep 25, 2018 at 01:49:09PM +1000, Haribabu Kommi wrote: >> Hmm. I see a problem with the tests and the stability of what >> pg_stat_statements_reset() can return. Norma

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-09-27 Thread Haribabu Kommi
On Tue, Sep 25, 2018 at 3:09 PM Michael Paquier wrote: > On Tue, Sep 25, 2018 at 01:49:09PM +1000, Haribabu Kommi wrote: > > Thanks for the review. > > Fixed in the attached patch as per your suggestion. > Thanks for the review. Hmm. I see a problem with the tests and the stability of what > p

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-09-24 Thread Michael Paquier
On Tue, Sep 25, 2018 at 01:49:09PM +1000, Haribabu Kommi wrote: > Thanks for the review. > Fixed in the attached patch as per your suggestion. Hmm. I see a problem with the tests and the stability of what pg_stat_statements_reset() can return. Normally installcheck is disabled in contrib/pg_stat

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-09-24 Thread Haribabu Kommi
On Tue, Sep 25, 2018 at 1:39 AM Michael Paquier wrote: > On Mon, Sep 24, 2018 at 12:19:44PM +1000, Haribabu Kommi wrote: > > Attached new rebased version of the patch that enhances the > > pg_stat_statements_reset() > > function. This needs to be applied on top of the patch that is posted in > >

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-09-24 Thread Michael Paquier
On Mon, Sep 24, 2018 at 12:19:44PM +1000, Haribabu Kommi wrote: > Attached new rebased version of the patch that enhances the > pg_stat_statements_reset() > function. This needs to be applied on top of the patch that is posted in > [1]. +CREATE ROLE stats_regress_user1; +CREATE ROLE stats_regress_

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-09-23 Thread Haribabu Kommi
On Mon, Sep 24, 2018 at 11:13 AM Haribabu Kommi wrote: > On Sat, Sep 22, 2018 at 11:23 PM Amit Kapila > wrote: > >> On Mon, Jul 9, 2018 at 11:28 AM Haribabu Kommi >> wrote: >> > >> > On Mon, Jul 9, 2018 at 3:39 PM Haribabu Kommi >> wrote: >> >> >> >> >> >> On Mon, Jul 9, 2018 at 12:24 PM Micha

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-09-23 Thread Haribabu Kommi
On Sat, Sep 22, 2018 at 11:23 PM Amit Kapila wrote: > On Mon, Jul 9, 2018 at 11:28 AM Haribabu Kommi > wrote: > > > > On Mon, Jul 9, 2018 at 3:39 PM Haribabu Kommi > wrote: > >> > >> > >> On Mon, Jul 9, 2018 at 12:24 PM Michael Paquier > wrote: > >>> > >>> On Fri, Jul 06, 2018 at 05:10:18PM -0

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-09-22 Thread Amit Kapila
On Mon, Jul 9, 2018 at 11:28 AM Haribabu Kommi wrote: > > On Mon, Jul 9, 2018 at 3:39 PM Haribabu Kommi > wrote: >> >> >> On Mon, Jul 9, 2018 at 12:24 PM Michael Paquier wrote: >>> >>> On Fri, Jul 06, 2018 at 05:10:18PM -0400, Alvaro Herrera wrote: >>> > Ugh, it's true :-( >>> > https://git.pos

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-10 Thread Haribabu Kommi
On Tue, Jul 10, 2018 at 12:26 AM Fujii Masao wrote: > On Sun, Jul 8, 2018 at 11:48 AM, Haribabu Kommi > wrote: > > > > On Fri, Jul 6, 2018 at 3:22 AM Fujii Masao > wrote: > >> > >> On Wed, Jul 4, 2018 at 7:12 PM, Haribabu Kommi < > kommi.harib...@gmail.com> > >> wrote: > >> > > >> > Update patc

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-09 Thread Fujii Masao
On Sun, Jul 8, 2018 at 11:48 AM, Haribabu Kommi wrote: > > On Fri, Jul 6, 2018 at 3:22 AM Fujii Masao wrote: >> >> On Wed, Jul 4, 2018 at 7:12 PM, Haribabu Kommi >> wrote: >> > >> > Update patch attached. >> >> + if (userid != 0 && dbid != 0 && queryid != 0) >> >> UINT64CONST() should be used fo

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-08 Thread Haribabu Kommi
On Mon, Jul 9, 2018 at 3:39 PM Haribabu Kommi wrote: > > On Mon, Jul 9, 2018 at 12:24 PM Michael Paquier > wrote: > >> On Fri, Jul 06, 2018 at 05:10:18PM -0400, Alvaro Herrera wrote: >> > Ugh, it's true :-( >> > >> https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=25fff40798fc4a

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-08 Thread Haribabu Kommi
On Mon, Jul 9, 2018 at 12:24 PM Michael Paquier wrote: > On Fri, Jul 06, 2018 at 05:10:18PM -0400, Alvaro Herrera wrote: > > Ugh, it's true :-( > > > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=25fff40798fc4ac11a241bfd9ab0c45c085e2212#patch8 > > > > Dave, Simon, any comment

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-08 Thread Michael Paquier
On Fri, Jul 06, 2018 at 05:10:18PM -0400, Alvaro Herrera wrote: > Ugh, it's true :-( > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=25fff40798fc4ac11a241bfd9ab0c45c085e2212#patch8 > > Dave, Simon, any comments? The offending line: contrib/pg_stat_statements/pg_stat_statement

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-07 Thread Haribabu Kommi
On Fri, Jul 6, 2018 at 3:22 AM Fujii Masao wrote: > On Wed, Jul 4, 2018 at 7:12 PM, Haribabu Kommi > wrote: > > > > Update patch attached. > > + if (userid != 0 && dbid != 0 && queryid != 0) > > UINT64CONST() should be used for the constant for queryid? > OK. > It's rare case, but 0 can be as

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-06 Thread Alvaro Herrera
On 2018-Jul-06, Sergei Kornilov wrote: > 06.07.2018, 22:35, "Robert Haas" : > > On Fri, Jul 6, 2018 at 1:26 PM, Fujii Masao wrote: > >>  Hmm... so pg_stat_statements_reset() is allowed to be executed by > >>  pg_read_all_stats role while other stats reset functions like > >>  pg_stat_reset() can

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-06 Thread Sergei Kornilov
06.07.2018, 22:35, "Robert Haas" : > On Fri, Jul 6, 2018 at 1:26 PM, Fujii Masao wrote: >>  Hmm... so pg_stat_statements_reset() is allowed to be executed by >>  pg_read_all_stats role while other stats reset functions like >>  pg_stat_reset() can be executed only by superusers. Which looks >>  st

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-06 Thread Robert Haas
On Fri, Jul 6, 2018 at 1:26 PM, Fujii Masao wrote: > Hmm... so pg_stat_statements_reset() is allowed to be executed by > pg_read_all_stats role while other stats reset functions like > pg_stat_reset() can be executed only by superusers. Which looks > strange and inconsistent to me. Yeah, why woul

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-06 Thread Fujii Masao
On Fri, Jul 6, 2018 at 3:34 AM, Sergei Kornilov wrote: > Hello > >> Currently pg_stat_statements_reset() and other stats reset functions like >> pg_stat_reset() can be executed only by superusers. >> But why did you allow pg_read_all_stats role to execute that function, >> by default? That change

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-05 Thread Sergei Kornilov
Hello > Currently pg_stat_statements_reset() and other stats reset functions like > pg_stat_reset() can be executed only by superusers. > But why did you allow pg_read_all_stats role to execute that function, > by default? That change looks strange to me. This is not behavior change, only fix docu

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-05 Thread Fujii Masao
On Wed, Jul 4, 2018 at 7:12 PM, Haribabu Kommi wrote: > > > On Mon, Jul 2, 2018 at 6:42 PM Sergei Kornilov wrote: >> >> Hello > > > Thanks for the review. > >> >> I found SELECT pg_stat_statements_reset(NULL,NULL,s.queryid) in tests and >> it pass tests, but i wonder how it works. Should not we c

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-04 Thread Sergei Kornilov
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: tested, passed Documentation:tested, passed I reviewed and tested patch one more times, including check w

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-04 Thread Haribabu Kommi
On Mon, Jul 2, 2018 at 6:42 PM Sergei Kornilov wrote: > Hello > Thanks for the review. > I found SELECT pg_stat_statements_reset(NULL,NULL,s.queryid) in tests and > it pass tests, but i wonder how it works. Should not we check the NULL > through PG_ARGISNULL macro before any PG_GETARG_*? Accor

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-02 Thread Sergei Kornilov
Hello I found SELECT pg_stat_statements_reset(NULL,NULL,s.queryid) in tests and it pass tests, but i wonder how it works. Should not we check the NULL through PG_ARGISNULL macro before any PG_GETARG_*? According src/include/fmgr.h > * If function is not marked "proisstrict" in pg_proc, it must

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-07-01 Thread Haribabu Kommi
On Fri, Jun 29, 2018 at 6:14 PM Sergei Kornilov wrote: > Hello > Thank you for update > Thanks for the review. > It may be better to use NULL as the default value at sql level. > Changed. > > ereport(LOG, (errmsg("userid %u, dbid %u, queryid %ld does not exist", > userid, dbid, queryid)));

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-06-29 Thread Vik Fearing
On 29/06/18 10:14, Sergei Kornilov wrote: > It may be better to use NULL as the default value at sql level. Absolutely. +1 from me. -- Vik Fearing +33 6 46 75 15 36 http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-06-29 Thread Sergei Kornilov
Hello Thank you for update It may be better to use NULL as the default value at sql level. > ereport(LOG, (errmsg("userid %u, dbid %u, queryid %ld does not exist", > userid, dbid, queryid))); I think LOG level is not useful here. In common case this is server log only. How about WARNING? Or jus

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-06-28 Thread Haribabu Kommi
On Sat, Jun 23, 2018 at 2:52 PM Ashutosh Sharma wrote: > On Sat, Jun 23, 2018 at 7:36 AM, Haribabu Kommi > wrote: > > On Sat, Jun 23, 2018 at 5:45 AM Euler Taveira > wrote: > >> > >> 2018-06-22 12:06 GMT-03:00 Robert Haas : > >> > On Wed, Jun 20, 2018 at 10:19 AM, Euler Taveira > > >> > wrote:

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-06-22 Thread Ashutosh Sharma
On Sat, Jun 23, 2018 at 7:36 AM, Haribabu Kommi wrote: > On Sat, Jun 23, 2018 at 5:45 AM Euler Taveira wrote: >> >> 2018-06-22 12:06 GMT-03:00 Robert Haas : >> > On Wed, Jun 20, 2018 at 10:19 AM, Euler Taveira >> > wrote: >> >> 2018-06-20 4:30 GMT-03:00 Haribabu Kommi : >> >>> Attached is a simp

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-06-22 Thread Haribabu Kommi
On Sat, Jun 23, 2018 at 5:45 AM Euler Taveira wrote: > 2018-06-22 12:06 GMT-03:00 Robert Haas : > > On Wed, Jun 20, 2018 at 10:19 AM, Euler Taveira > wrote: > >> 2018-06-20 4:30 GMT-03:00 Haribabu Kommi : > >>> Attached is a simple patch with implementation. Comments? > >>> > >> Why don't you ex

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-06-22 Thread Euler Taveira
2018-06-22 12:06 GMT-03:00 Robert Haas : > On Wed, Jun 20, 2018 at 10:19 AM, Euler Taveira wrote: >> 2018-06-20 4:30 GMT-03:00 Haribabu Kommi : >>> Attached is a simple patch with implementation. Comments? >>> >> Why don't you extend the existing function pg_stat_statements_reset()? > > Well, the

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-06-22 Thread Rui DeSousa
Why not just parameterize it with the three key fields; userid, dbid, and queryid? i.e It would then allow it be limited to only records associated with a given user and/or database as well. pg_stat_statements_reset(dbid oid, userid oid, queryid bigint) pg_stat_statements_reset(null, null, 356

Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query

2018-06-22 Thread Robert Haas
On Wed, Jun 20, 2018 at 10:19 AM, Euler Taveira wrote: > 2018-06-20 4:30 GMT-03:00 Haribabu Kommi : >> Attached is a simple patch with implementation. Comments? >> > Why don't you extend the existing function pg_stat_statements_reset()? Well, the existing function doesn't take any arguments. We

  1   2   >