Thread: pgsql: Add infrastructure to track WAL usage.

pgsql: Add infrastructure to track WAL usage.

From
Amit Kapila
Date:
Add infrastructure to track WAL usage.

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
Reviewed-by: Dilip Kumar, Fujii Masao and Amit Kapila
Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/df3b181499b40523bd6244a4e5eb554acb9020ce

Modified Files
--------------
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(-)