]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Eliminate XLOG_HEAP2_VISIBLE from vacuum phase III
authorMelanie Plageman <melanieplageman@gmail.com>
Mon, 13 Oct 2025 22:01:06 +0000 (18:01 -0400)
committerMelanie Plageman <melanieplageman@gmail.com>
Mon, 13 Oct 2025 22:01:06 +0000 (18:01 -0400)
commitadd323da40a6bf9e01cdda510e32ea924c89cd1a
tree461ac5c4af99cb1d3db4fd103bb819574431ca34
parent03bf7a12c5a44ced377352c8f9bf6e9f4b863885
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 <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com
src/backend/access/heap/heapam_xlog.c
src/backend/access/heap/pruneheap.c
src/backend/access/heap/vacuumlazy.c
src/backend/access/rmgrdesc/heapdesc.c
src/include/access/heapam.h
src/include/access/heapam_xlog.h