This allows gathering the WAL generation statistics for each statement execution. The three statistics that we collect are the number of WAL records, the number of full page writes and the amount of WAL bytes generated.
This helps the users who have write-intensive workload to see the impact of I/O due to WAL. This further enables us to see approximately what percentage of overall WAL is due to full page writes.
In the future, we can extend this functionality to allow us to compute the the exact amount of WAL data due to full page writes.
This patch in itself is just an infrastructure to compute WAL usage data. The upcoming patches will expose this data via explain, auto_explain, pg_stat_statements and verbose (auto)vacuum output.
Author: Kirill Bychik, Julien Rouhaud
df3b181499 Add infrastructure to track WAL usage.
src/backend/access/heap/vacuumlazy.c | 37 +++++++++++++++++------
src/backend/access/nbtree/nbtsort.c | 40 +++++++++++++++++++++++++
src/backend/access/transam/xlog.c | 12 +++++++-
src/backend/access/transam/xloginsert.c | 13 +++++---
src/backend/executor/execParallel.c | 36 ++++++++++++++++------
src/backend/executor/instrument.c | 53 +++++++++++++++++++++++++++++----
src/include/access/xlog.h | 3 +-
src/include/executor/execParallel.h | 1 +
src/include/executor/instrument.h | 18 +++++++++--
src/tools/pgindent/typedefs.list | 1 +
10 files changed, 182 insertions(+), 32 deletions(-)