Add wal_fpi_bytes to pg_stat_wal and pg_stat_get_backend_wal()
authorMichael Paquier <michael@paquier.xyz>
Tue, 28 Oct 2025 07:21:51 +0000 (16:21 +0900)
committerMichael Paquier <michael@paquier.xyz>
Tue, 28 Oct 2025 07:21:51 +0000 (16:21 +0900)
commitf9a09aa2952039a9956b44d929b9df74d62a4cd4
treec68534ad90e49cc537e99fa5193c74454ec9f3b1
parent3e8e05596a020f043f1efd6406e4511ea85170bd
Add wal_fpi_bytes to pg_stat_wal and pg_stat_get_backend_wal()

This new counter, called "wal_fpi_bytes", tracks the total amount in
bytes of full page images (FPIs) generated in WAL.  This data becomes
available globally via pg_stat_wal, and for backend statistics via
pg_stat_get_backend_wal().

Previously, this information could only be retrieved with pg_waldump or
pg_walinspect, which may not be available depending on the environment,
and are expensive to execute.  It offers hints about how much FPIs
impact the WAL generated, which could be a large percentage for some
workloads, as well as the effects of wal_compression or page holes.

Bump catalog version.
Bump PGSTAT_FILE_FORMAT_ID, due to the addition of wal_fpi_bytes in
PgStat_WalCounters.

Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAOzEurQtZEAfg6P0kU3Wa-f9BWQOi0RzJEMPN56wNTOmJLmfaQ@mail.gmail.com
12 files changed:
doc/src/sgml/monitoring.sgml
src/backend/access/transam/xloginsert.c
src/backend/catalog/system_views.sql
src/backend/executor/instrument.c
src/backend/utils/activity/pgstat_backend.c
src/backend/utils/activity/pgstat_wal.c
src/backend/utils/adt/pgstatfuncs.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/include/executor/instrument.h
src/include/pgstat.h
src/test/regress/expected/rules.out