Re: Add new option 'all' to pg_stat_reset_shared()

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: torikoshia <torikoshia@oss.nttdata.com>
Cc: Andres Freund <andres@anarazel.de>, boekewurm+postgres@gmail.com, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@postgresql.org, bharath.rupireddyforpostgres@gmail.com
Date: 2023-11-15T07:25:14Z
Lists: pgsql-hackers
On Wed, Nov 15, 2023 at 11:58:38AM +0900, torikoshia wrote:
> On 2023-11-15 09:47, Michael Paquier wrote:
>> You have forgotten to update the errhint at the end of
>> pg_stat_reset_shared(), where "slru" needs to be listed :)
> 
> Oops, attached v2 patch.

+SELECT stats_reset > :'slru_reset_ts'::timestamptz FROM pg_stat_slru;

A problem with these two queries is that they depend on the number of
SLRUs set in the system while only returning a single 't' without the
cache names each tuple is linked to.  To keep things simple, you could
just LIMIT 1 or aggregate through the whole set.

Other than that, it looks OK.
--
Michael

Commits

  1. Add target "slru" to pg_stat_reset_shared()

  2. doc: Improve description of targets for pg_stat_reset_shared()

  3. Add support for pg_stat_reset_slru without argument

  4. Add ability to reset all shared stats types in pg_stat_reset_shared()