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

Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>

From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: torikoshia <torikoshia@oss.nttdata.com>, boekewurm+postgres@gmail.com, Michael Paquier <michael@paquier.xyz>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-11-08T08:45:24Z
Lists: pgsql-hackers

Attachments

On Wed, Nov 8, 2023 at 9:43 AM Andres Freund <andres@anarazel.de> wrote:
>
> > 2.
> > +{ oid => '8000',
> > +  descr => 'statistics: reset collected statistics shared across the cluster',
> > +  proname => 'pg_stat_reset_shared', provolatile => 'v', prorettype => 'void',
> > +  proargtypes => '', prosrc => 'pg_stat_reset_shared_all' },
> >
> > Why a new function consuming the oid? Why can't we just do the trick
> > of proisstrict => 'f' and if (PG_ARGISNULL(0)) { reset all stats} else
> > {reset specified stats kind} like the pg_stat_reset_slru()?
>
> 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).

+1. Attached the patch.

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

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()