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

Sergei Kornilov <sk@zsrv.org>

From: Sergei Kornilov <sk@zsrv.org>
To: Robert Haas <robertmhaas@gmail.com>, Fujii Masao <masao.fujii@gmail.com>
Cc: Haribabu Kommi <kommi.haribabu@gmail.com>, Ashutosh Sharma <ashu.coek88@gmail.com>, Euler Taveira <euler@timbira.com.br>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2018-07-06T20:56:22Z
Lists: pgsql-hackers
06.07.2018, 22:35, "Robert Haas" <robertmhaas@gmail.com>:
> On Fri, Jul 6, 2018 at 1:26 PM, Fujii Masao <masao.fujii@gmail.com> wrote:
>>  Hmm... so pg_stat_statements_reset() is allowed to be executed by
>>  pg_read_all_stats role while other stats reset functions like
>>  pg_stat_reset() can be executed only by superusers. Which looks
>>  strange and inconsistent to me.
>
> Yeah, why would a pg_READ_all_stats role let you change stuff?

+1, personally i was surprised first time. But I thought that it was discussed before committing version 1.5
I read original thread [1] and, as far i see, pg_stat_statements_reset change was not discussed.

Let's remove this grant?
Or grant to pg_monitor role instead of pg_read_all_stats?

regards, Sergei

[1] https://www.postgresql.org/message-id/flat/CA+OCxoyRdsc1xyLfF9s698gUGyPXBs4CvJ+0Gwo8U65NmYJ7pw@mail.gmail.com


Commits

  1. Extend pg_stat_statements_reset to reset statistics specific to a

  2. Default monitoring roles