Re: per backend WAL statistics

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers@lists.postgresql.org
Date: 2025-02-05T10:31:13Z
Lists: pgsql-hackers
On Wed, Feb 05, 2025 at 10:22:55AM +0000, Bertrand Drouvot wrote:
> So, wal_buffers_full has been introduced after the WalUsage structure was
> there but I don't see any reason in the emails as to why it's not in the WalUsage
> structure (I might have missed it though).
> 
> I think that this proposal makes sense but would need a dedicated thread,
> thoughts?

Using a separate thread for a change like that makes sense to me.  I
have to admit that the simplifications in terms of designs for what
we're discussing here makes such a change more valuable.  Adding this
information to WalUsage is one thing.  Showing it in EXPLAIN is a
second thing.  Doing the former simplifies the patch you are proposing
here.  We don't necessarily have to do the latter, but I don't see a
reason to not do it, either.
--
Michael

Commits

  1. Fix use-after-free in pgstat_fetch_stat_backend_by_pid()

  2. Remove initialization from PendingBackendStats

  3. Add WAL data to backend statistics

  4. Improve check for detection of pending data in backend statistics

  5. Fix some gaps in pg_stat_io with WAL receiver and WAL summarizer

  6. Handle auxiliary processes in SQL functions of backend statistics

  7. Invent pgstat_fetch_stat_backend_by_pid()

  8. Refactor code of pg_stat_get_wal() building result tuple

  9. Adding new PgStat_WalCounters structure in pgstat.h

  10. Remove pgstat_flush_wal()

  11. Refactor some code related to backend statistics

  12. Add backend-level statistics to pgstats