pgsql: Eliminate XLOG_HEAP2_VISIBLE from vacuum phase III

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Eliminate XLOG_HEAP2_VISIBLE from vacuum phase III
Date: 2025-10-13 22:03:15
Message-ID: E1v8QdP-001YO2-0w@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)gmail(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Robert Haas <robertmhaas(at)gmail(dot)com>
Reviewed-by: Kirill Reshke <reshkekirill(at)gmail(dot)com>
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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-10-13 23:31:50 pgsql: Fix version number calculation for data folder flush in pg_combi
Previous Message Tom Lane 2025-10-13 21:57:04 pgsql: Fix incorrect message-printing in win32security.c.