Re: per backend I/O statistics
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Nazir Bilal Yavuz <byavuz81@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, Kyotaro Horiguchi <horikyota.ntt@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2024-11-20T00:01:26Z
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
Commits
-
Rework handling of pending data for backend statistics
- 4feba03d8b92 18.0 landed
-
Rename some pgstats callbacks related to flush of entries
- 28de66cee5f4 18.0 landed
-
Relax regression test for fsync check of backend-level stats
- 546371599e76 18.0 landed
-
Add backend-level statistics to pgstats
- 9aea73fc61d4 18.0 landed
-
Extract logic filling pg_stat_get_io()'s tuplestore into its own routine
- ff7c40d7fd6a 18.0 landed
-
Tweak some comments related to variable-numbered stats in pgstat.c
- fee2b3ea2ecd 18.0 landed