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

From Andres Freund
Subject Re: Add new option 'all' to pg_stat_reset_shared()
Date
Msg-id 20231109012952.fft2i356ofljugt6@awork3.anarazel.de
Whole thread Raw
In response to Re: Add new option 'all' to pg_stat_reset_shared()  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Add new option 'all' to pg_stat_reset_shared()
List pgsql-hackers
Hi,

On 2023-11-09 10:25:18 +0900, Michael Paquier wrote:
> On Thu, Nov 09, 2023 at 10:10:39AM +0900, torikoshia wrote:
> > I am a little concerned about that the reset time is not the same and that
> > GetCurrentTimestamp() is called multiple times, but I think it would be
> > acceptable because the function is probably not used that often and the
> > reset time is not atomic in practice.
> 
> Arf, right.  I misremembered that this is just a clock_timestamp() so
> that's not transaction-resilient.  Anyway, my take is that this is not
> a big deal in practice compared to the usability of the wrapper.

It seems inconsequential cost-wise. Resetting stats is way more expensive that
a few timestamp determinations. Correctness wise it actually seems *better* to
record the timestamps more granularly, after all, that moves them closer to
the time the individual kind of stats is reset.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Crisp Lee
Date:
Subject: Re: make pg_ctl more friendly
Next
From: Andres Freund
Date:
Subject: Re: make pg_ctl more friendly