mirror of
https://github.com/postgres/postgres.git
synced 2025-11-09 06:21:09 +03:00
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
This commit is contained in:
@@ -33,12 +33,14 @@
|
||||
#include "access/xloginsert.h"
|
||||
#include "catalog/pg_control.h"
|
||||
#include "common/pg_lzcompress.h"
|
||||
#include "executor/instrument.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pg_trace.h"
|
||||
#include "replication/origin.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/proc.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/pgstat_internal.h"
|
||||
|
||||
/*
|
||||
* Guess the maximum buffer size required to store a compressed version of
|
||||
@@ -796,6 +798,10 @@ XLogRecordAssemble(RmgrId rmid, uint8 info,
|
||||
}
|
||||
|
||||
total_len += bimg.length;
|
||||
|
||||
/* Track the WAL full page images in bytes */
|
||||
pgWalUsage.wal_fpi_bytes += bimg.length;
|
||||
pgstat_report_fixed = true;
|
||||
}
|
||||
|
||||
if (needs_data)
|
||||
|
||||
Reference in New Issue
Block a user