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

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Euler Taveira <euler(at)timbira(dot)com(dot)br>
Cc: Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New function pg_stat_statements_reset_query() to reset statistics of a specific query
Date: 2018-06-22 15:06:10
Message-ID: CA+Tgmoad42uARzZ4GGQLAUWO9jb0+YErWh90nszBYjZc-rx0kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 20, 2018 at 10:19 AM, Euler Taveira <euler(at)timbira(dot)com(dot)br> wrote:
> 2018-06-20 4:30 GMT-03:00 Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com>:
>> Attached is a simple patch with implementation. Comments?
>>
> Why don't you extend the existing function pg_stat_statements_reset()?

Well, the existing function doesn't take any arguments. We could add
an additional version of it that takes an argument, or we could
replace the existing version with one that has an optional argument.
But are either of those things any better than just adding a new
function with a different name, like
pg_stat_statements_reset_statement()?

I have not had such good experiences with function overloading, either
in PostgreSQL or elsewhere, that I'm ready to say reusing the same
name is definitely the right approach. For example, suppose we
eventually end up with a function that resets all the statements, a
function that resets just one statement, a function that resets all
statements for one user, and a function that resets all statements
where the statement text matches a certain regexp. If those all have
separate names, everything is fine. If they all have the same name,
there's no way that's not confusing.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2018-06-22 15:15:53 Re: Incorrect errno used with %m for backend code
Previous Message Robert Haas 2018-06-22 15:02:00 Re: [PATCH] Include application_name in "connection authorized" log message