Re: Add new option 'all' to pg_stat_reset_shared() - Mailing list pgsql-hackers

From torikoshia
Subject Re: Add new option 'all' to pg_stat_reset_shared()
Date
Msg-id 37bce6feca33e0c0441cd33f9eaa51d6@oss.nttdata.com
Whole thread Raw
In response to Re: Add new option 'all' to pg_stat_reset_shared()  (Andres Freund <andres@anarazel.de>)
Responses Re: Add new option 'all' to pg_stat_reset_shared()
List pgsql-hackers
On Thu, Nov 09, 2023 at 10:10:39AM +0900, torikoshia wrote:
> I'll attach the patch.
Attached.

On Mon, Nov 6, 2023 at 5:30 PM Bharath Rupireddy
> 3. I think the new reset all stats function must also consider
> resetting all SLRU stats, no?
>     /* stats for fixed-numbered objects */
>     PGSTAT_KIND_ARCHIVER,
>     PGSTAT_KIND_BGWRITER,
>     PGSTAT_KIND_CHECKPOINTER,
>     PGSTAT_KIND_IO,
>     PGSTAT_KIND_SLRU,
>     PGSTAT_KIND_WAL,

PGSTAT_KIND_SLRU cannot be reset by pg_stat_reset_shared(), so I feel 
uncomfortable to delete it all together.
It might be better after pg_stat_reset_shared() has been modified to 
take 'slru' as an argument, though.


On Wed, Nov 8, 2023 at 1:13 PM Andres Freund <andres@anarazel.de> wrote:
> It's not like oids are a precious resource. It's a more confusing API 
> to have
> to have to specify a NULL as an argument than not having to do so. If 
> we
> really want to avoid a separate oid, a more sensible path would be to 
> add a
> default argument to pg_stat_reset_slru() (by doing a CREATE OR REPLACE 
> in
> system_functions.sql).

Currently proisstrict is true and pg_stat_reset_shared() returns null 
without doing any work.
I thought it would be better to reset statistics even when null is 
specified so that users are not confused with the behavior of 
pg_stat_reset_slru().
Attached patch added pg_stat_reset_shared() in system_functions.sql 
mainly for this reason.

-- 
Regards,

--
Atsushi Torikoshi
NTT DATA Group Corporation
Attachment

pgsql-hackers by date:

Previous
From: zhihuifan1213@163.com
Date:
Subject: Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)
Next
From: Michael Paquier
Date:
Subject: Re: A recent message added to pg_upgade