Eliminate XLOG_HEAP2_VISIBLE from vacuum phase III

Instead of emitting a separate XLOG_HEAP2_VISIBLE WAL record for each
page that becomes all-visible in vacuum's third phase, specify the VM
changes in the already emitted XLOG_HEAP2_PRUNE_VACUUM_CLEANUP record.

Visibility checks are now performed before marking dead items unused.
This is safe because the heap page is held under exclusive lock for the
entire operation.

This reduces the number of WAL records generated by VACUUM phase III by
up to 50%.

Author: Melanie Plageman <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Reviewed-by: Robert Haas <[email protected]>
Reviewed-by: Kirill Reshke <[email protected]>
Discussion: 
https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/access/heap/heapam_xlog.c  | 128 +++++++++++++++++++------
src/backend/access/heap/pruneheap.c    |  55 ++++++++++-
src/backend/access/heap/vacuumlazy.c   | 166 ++++++++++++++++++++++++---------
src/backend/access/rmgrdesc/heapdesc.c |  11 ++-
src/include/access/heapam.h            |   1 +
src/include/access/heapam_xlog.h       |  17 +++-
6 files changed, 302 insertions(+), 76 deletions(-)

Reply via email to