Re: per backend I/O statistics

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: per backend I/O statistics
Date: 2024-11-20 00:01:26
Message-ID: Zz0m1k03k5LA_c8S@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 19, 2024 at 04:28:55PM +0000, Bertrand Drouvot wrote:
> So, for the startup process only, what about?
>
> - don't call pgstat_create_backend_stat() in pgstat_beinit()...
> - but call it in StartupXLOG() instead (after the stats are discarded or restored).
>
> That way we could get rid of the changes linked to the assertion and still handle
> the startup process particular case. Thoughts?

Hmm. That may prove to be a good idea in the long-term. The startup
process is a specific path kicked in at a very early stage, so it is
also a bit weird that we'd try to insert statistics while we are going
to reset them anyway a bit later. That may also be relevant for
custom statistics, actually, especially if some calls happen in some
hook paths taken before the reset is done. This could happen for
injection point stats when loading it with shared_preload_libraries,
actually, if you load, attach or run a callback at this early stage.
The existing sanity checks are a safety net that we should not change
or adapt for specific stats kinds conditions, IMO. Perhaps this had
better be done as a patch of its own, on top of the rest.

> Yeah that's the reason why I suggested "pgstat_backend.c". I would not be
> surprised if we add more "per backend" stats (that are not I/O related) in the
> future as the main machinery would be there.

Okay.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikita Glukhov 2024-11-20 00:06:16 Re: SQL:2023 JSON simplified accessor support
Previous Message Mark Dilger 2024-11-19 23:26:09 Re: Index AM API cleanup