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

From: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(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>, Pg 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-16 04:13:44
Message-ID: CAJrrPGdCwmypztmMX=6Z2=6NY9VaitgHdtitt=O1b9LRzXkQ+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Nov 15, 2018 at 5:18 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

> On Thu, Nov 15, 2018 at 11:38 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> wrote:
> >
> > On Thu, Nov 15, 2018 at 2:05 AM Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>
> wrote:
> > >
> > > On Wed, Nov 14, 2018 at 8:45 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
> 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 all the 3 parameters are valid.
> > > Updated patch attached.
> > >
> >
> > +--
> > +-- 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 pg_roles AS r
> > WHERE r.rolname = 'regress_stats_user2'),
> > + (SELECT d.oid from pg_database As d where datname =
> current_database()),
> > + (SELECT s.queryid FROM pg_stat_statements AS s WHERE s.query =
> > 'SELECT $1 AS "ONE"'));
> >
> > The query in comments is different than what is actually used? And
> > how is able to remove the correct statement from hash (it seems you
> > intended to remove 'SELECT $1 AS "ONE"', but it removed 'SELECT $1 +
> > $2 AS "TWO"')?
> >
>
> One more point, the length of each line is too long in this statement,
> try to reduce it by starting parameters for pg_stat_statements_reset
> from next line or something like that.
>

Sorry for the mistake.
Attached patch synced the comment and SQL statement. And also I
rearranged the all options test as first compared to others.

Regards,
Haribabu Kommi
Fujitsu Australia

Attachment Content-Type Size
0001-pg_stat_statements_reset-to-reset-specific-query-use_v12.patch application/octet-stream 20.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2018-11-16 04:16:27 Re: Undo logs
Previous Message Michael Paquier 2018-11-16 04:00:23 Re: ATTACH/DETACH PARTITION CONCURRENTLY