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: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, 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>, 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-04 01:07:24
Message-ID: CAJrrPGdCvQhBYcO_UeMMR2x=MJVabSx-K5poehrvb0Mbzfq2Ww@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Nov 4, 2018 at 11:17 AM Michael Paquier <michael(at)paquier(dot)xyz> 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 patch, it works just fine.
>
> Good point. We surely want to have a stable feature, which gets tested
> without triggering random failures in the builfarm.
>

Thanks for the review.

This patch has changed the pg_stat_statements_reset() function from
returning void
to number statements that it reset. The regression test contains
pg_stat_statements_reset()
as first query to reset any of the query stats that are already tracked to
let the test to
provide the proper results. But with this feature, if we test this
regression test on an
already running server, the first query result is varying and it leads to
test failure.

So to fix this problem, I added a wrapper function that masks the result of
the
pg_stat_statements_reset() function and just return as void, with this
wrapper function
used a first statement, the test is stable, as this function takes care of
resetting already
existing statements from the already running server.

With the above change, the regression test is stable. Comments?

Regards,
Haribabu Kommi
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2018-11-04 01:15:35 Re: heap_sync seems rather oblivious to partitioned tables (wal_level=minimal)
Previous Message Robert Haas 2018-11-04 01:00:11 Re: Resetting PGPROC atomics in ProcessInit()