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

From: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, bharath(dot)rupireddyforpostgres(at)gmail(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add new option 'all' to pg_stat_reset_shared()
Date: 2023-10-31 07:26:18
Message-ID: bef9580768ec5e59cae0bd0dbd6e9452@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 30, 2023 at 5:46 PM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:

Thanks for the comments!

> Isn't calling pg_stat_reset_shared() for all stats types helping you
> out? Is there any problem with it? Can you be more specific about the
> use-case?

Yes, calling pg_stat_reset_shared() for all stats types can do what I
wanted to do.
But calling it with 6 different parameters seems tiresome and I thought
it would be convenient to have a parameter to delete all cluster-wide
statistics at once.

I may be wrong, but I imagine that it's more common to want to delete
all of the statistics for an entire cluster rather than just a portion
of it.

> IMV, I don't see any point for adding another pseudo (rather
> non-existent) shared stats target which might confuse users - it's
> easy to specify pg_stat_reset_shared('all'); to clear things out when
> someone actually doesn't want to reset all - an accidental usage of
> the 'all' option will reset all shared memory stats.

I once considered changing the pg_stat_reset_shared() to delete all
stats when called without parameters like pg_stat_statements_reset(),
but gave it up since it can confuse users as you described.

I was hoping that the need to specify 'all' would remind users that the
target can be specified individually.

--
Regards,

--
Atsushi Torikoshi
NTT DATA Group Corporation

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2023-10-31 08:09:24 Allowing TRUNCATE of FK target when session_replication_role=replica
Previous Message Corey Huinker 2023-10-31 07:25:17 Re: Statistics Import and Export