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

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: sk(at)zsrv(dot)org, vik(dot)fearing(at)2ndquadrant(dot)com, Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Magnus Hagander <magnus(at)hagander(dot)net>, 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-30 18:54:53
Message-ID: da3adb22-4824-5a87-8407-73370f31476e@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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
>> something like pg_stat_statements_reset(<valid_user_id>,
>> <valid_db_id>, SELECT s.queryid FROM pg_stat_statements AS s WHERE
>> s.query = 'SELECT $1 AS "ONE"'); now, if the query doesn't return any
>> row, we will remove the stats for all queries that belong to
>> (userid,dbid). It could be surprising for some users, that's why we
>> came up with option-4 where we keep the default value of parameters as
>> 0.
>
> 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 think option 4 is the right choice, and with named parameters and
default values it will also be very convenient.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2018-11-30 19:06:47 Re: ToDo: show size of partitioned table
Previous Message David Fetter 2018-11-30 18:53:18 [PATCH] Log CSV by default