From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: heapam: Add batch mode mvcc check and use it in page mode
Date: Mon, 12 Jan 2026 18:34:32 +0000
Message-ID: <E1vfMkJ-00057G-1I@gemulon.postgresql.org> (raw)
heapam: Add batch mode mvcc check and use it in page mode
There are two reasons for doing so:
1) It is generally faster to perform checks in a batched fashion and making
sequential scans faster is nice.
2) We would like to stop setting hint bits while pages are being written
out. The necessary locking becomes visible for page mode scans, if done for
every tuple. With batching, the overhead can be amortized to only happen
once per page.
There are substantial further optimization opportunities along these
lines:
- Right now HeapTupleSatisfiesMVCCBatch() simply uses the single-tuple
HeapTupleSatisfiesMVCC(), relying on the compiler to inline it. We could
instead write an explicitly optimized version that avoids repeated xid
tests.
- Introduce batched version of the serializability test
- Introduce batched version of HeapTupleSatisfiesVacuum
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/0b96e734c5904ee26b8f622b3348620dda4bfee5
Modified Files
--------------
src/backend/access/heap/heapam.c | 84 ++++++++++++++++++++++-------
src/backend/access/heap/heapam_visibility.c | 43 +++++++++++++++
src/include/access/heapam.h | 17 ++++++
src/tools/pgindent/typedefs.list | 1 +
4 files changed, 125 insertions(+), 20 deletions(-)
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: andres@anarazel.de, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: heapam: Add batch mode mvcc check and use it in page mode
In-Reply-To: <E1vfMkJ-00057G-1I@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