Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query
Date
Msg-id CAA4eK1K5HsyoF0Dm7e_WvC2Xmo9QJZaQOKy-tRxRcd6Sou1Apw@mail.gmail.com
Whole thread Raw
In response to Re: New function pg_stat_statements_reset_query() to reset statisticsof a specific query  (Vik Fearing <vik.fearing@2ndquadrant.com>)
List pgsql-hackers
On Mon, Nov 26, 2018 at 5:40 PM Vik Fearing <vik.fearing@2ndquadrant.com> wrote:
>
> On 23/11/2018 00:09, Haribabu Kommi wrote:
> >
> > On Fri, Nov 23, 2018 at 1:54 AM Peter Eisentraut
> > <peter.eisentraut@2ndquadrant.com
> > <mailto:peter.eisentraut@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 invalid value
> >     > 2. Multiple API to deal with NULL input of other values
> >     > 3. Single API with NULL value to treat them as current user, current
> >     > database
> >     >  and NULL queryid.
> >     > 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.
> >
> >     Can you show examples of what these would look like?
> >
> >
> > Following are some of the examples how the various options
> > work.
> >
> > Option -1:
> >
> > select pg_stat_statements_reset(NULL,NULL,NULL);
> > -- No change, just return. Because the function is strict.
> >
> > select pg_stat_statements_reset(10,10,NULL);
> > -- Resets all the statements that are executed by userid 10 on database
> > id 10.
> >
> > select pg_stat_statements_reset(NULL,10,NULL);
> > -- Resets all the statements executed on database id 10
>
> If the function is strict, none of these will do anything.
>
> My preference is for NULL to mean *all* so this is my favorite option,
> except that the first query should reset everything.
>
> +1 with that change.
>

Thanks, Vik for sharing feedback.  So, here is a summarization of what
different people think:

Option-1: Vik
Option-2: Alvaro, Magnus
Option-3: Michael, Hari
Option-4: Amit, Hari, Magnus


We still can't conclude clearly, but I think Option-2 and Option-4 are
the ones which appear to be more popular.  Does anyone else want to
weigh in here?  If no more people share an opinion, I will go with one
among Option-2 or Option-4.

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: "Ideriha, Takeshi"
Date:
Subject: RE: idle-in-transaction timeout error does not give a hint
Next
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Copy data to DSA area