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

From: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, bharath(dot)rupireddyforpostgres(at)gmail(dot)com, michael(at)paquier(dot)xyz
Cc: boekewurm+postgres(at)gmail(dot)com, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add new option 'all' to pg_stat_reset_shared()
Date: 2023-11-09 04:50:34
Message-ID: 37bce6feca33e0c0441cd33f9eaa51d6@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)anarazel(dot)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 Content-Type Size
v1-0001-Add-ability-to-reset-all-statistics-to-pg_stat_re.patch text/x-diff 8.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-11-09 04:54:54 Re: A recent message added to pg_upgade
Previous Message zhihuifan1213 2023-11-09 04:33:34 Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)