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

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: vik(dot)fearing(at)2ndquadrant(dot)com
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Magnus Hagander <magnus(at)hagander(dot)net>, sk(at)zsrv(dot)org, 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-28 07:47:58
Message-ID: CAA4eK1K5HsyoF0Dm7e_WvC2Xmo9QJZaQOKy-tRxRcd6Sou1Apw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 26, 2018 at 5:40 PM Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com> wrote:
>
> On 23/11/2018 00:09, Haribabu Kommi wrote:
> >
> > On Fri, Nov 23, 2018 at 1:54 AM Peter Eisentraut
> > <peter(dot)eisentraut(at)2ndquadrant(dot)com
> > <mailto:peter(dot)eisentraut(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2018-11-28 08:08:46 Re: Copy data to DSA area
Previous Message Ideriha, Takeshi 2018-11-28 07:12:51 RE: idle-in-transaction timeout error does not give a hint