pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Melanie Plageman <melanieplageman@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Eliminate XLOG_HEAP2_VISIBLE from vacuum phase III
Date: Mon, 13 Oct 2025 22:03:15 +0000
Message-ID: <E1v8QdP-001YO2-0w@gemulon.postgresql.org> (raw)

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

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



Message-ID: <E1v8QdP-001YO2-0w@gemulon.postgresql.org>
Permalink:  ../E1v8QdP-001YO2-0w@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1v8QdP-001YO2-0w@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: melanieplageman@gmail.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Eliminate XLOG_HEAP2_VISIBLE from vacuum phase III
  In-Reply-To: <E1v8QdP-001YO2-0w@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox