Re: pg_stat_reset_single_*_counters vs pg_stat_database.stats_reset

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org, Magnus Hagander <magnus(at)hagander(dot)net>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Tomas Vondra <tv(at)fuzzy(dot)cz>
Subject: Re: pg_stat_reset_single_*_counters vs pg_stat_database.stats_reset
Date: 2022-03-24 00:59:38
Message-ID: 20220324005938.rd4meezm5gcdmii2@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-03-23 17:55:16 -0700, Andres Freund wrote:
> Maybe I just don't understand what these reset functions are intended for?
> Their introduction [3] didn't explain much either. To me the behaviour of
> resetting pg_stat_database.stats_reset but nothing else in pg_stat_database
> makes them kind of dangerous.

Forgot to add: At the very least we should document that weird behaviour,
because it's certainly not obvious. But imo we should either remove the
behaviour or drop the functions.

<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pg_stat_reset_single_table_counters</primary>
</indexterm>
<function>pg_stat_reset_single_table_counters</function> ( <type>oid</type> )
<returnvalue>void</returnvalue>
</para>
<para>
Resets statistics for a single table or index in the current database
or shared across all databases in the cluster to zero.
</para>
<para>
This function is restricted to superusers by default, but other users
can be granted EXECUTE to run the function.
</para></entry>
</row>

<row>
<entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pg_stat_reset_single_function_counters</primary>
</indexterm>
<function>pg_stat_reset_single_function_counters</function> ( <type>oid</type> )
<returnvalue>void</returnvalue>
</para>
<para>
Resets statistics for a single function in the current database to
zero.
</para>
<para>
This function is restricted to superusers by default, but other users
can be granted EXECUTE to run the function.
</para></entry>
</row>

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-03-24 01:06:36 Re: [PATCH] add relation and block-level filtering to pg_waldump
Previous Message Andres Freund 2022-03-24 00:55:16 pg_stat_reset_single_*_counters vs pg_stat_database.stats_reset