Add infrastructure to track WAL usage.
authorAmit Kapila <[email protected]>
Sat, 4 Apr 2020 04:32:08 +0000 (10:02 +0530)
committerAmit Kapila <[email protected]>
Sat, 4 Apr 2020 04:32:08 +0000 (10:02 +0530)
commitdf3b181499b40523bd6244a4e5eb554acb9020ce
tree520cb5eee0f4c1404face0b9df8be2c68158a7d2
parent0588ee63aa2d8c5765d086991555cd9acdd4d86f
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  in itself is just an infrastructure to compute WAL usage data.
The upcoming es 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
src/backend/access/heap/vacuumlazy.c
src/backend/access/nbtree/nbtsort.c
src/backend/access/transam/xlog.c
src/backend/access/transam/xloginsert.c
src/backend/executor/execParallel.c
src/backend/executor/instrument.c
src/include/access/xlog.h
src/include/executor/execParallel.h
src/include/executor/instrument.h
src/tools/pgindent/typedefs.list