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-12-12T04:11:09Z
Lists: pgsql-hackers
On Wed, Nov 27, 2024 at 04:00:14PM +0000, Bertrand Drouvot wrote:
> I'd vote to just keep the pgstat_create_backend_stat() call in pgstat_beinit().
> 
> That said, we probably should document that init_backend_cb() should not call
> pgstat_get_entry_ref(), but that's probably worth another thread.

Hmm, yeah.  I have considered this point and your approach does not
seem that bad to me after thinking much more about it, and you are
putting the call in pgstat_beinit(), which is about initializing the
stats for the backend.  So I'm OK with what the patch does here in
terms of the location where pgstat_create_backend_stat() is called.
--
Michael

Commits

  1. Rework handling of pending data for backend statistics

  2. Rename some pgstats callbacks related to flush of entries

  3. Relax regression test for fsync check of backend-level stats

  4. Add backend-level statistics to pgstats

  5. Extract logic filling pg_stat_get_io()'s tuplestore into its own routine

  6. Tweak some comments related to variable-numbered stats in pgstat.c