]> git.ipfire.org Git - thirdparty/postgresql.git/commit
heapam: Add batch mode mvcc check and use it in page mode
authorAndres Freund <andres@anarazel.de>
Mon, 12 Jan 2026 18:14:58 +0000 (13:14 -0500)
committerAndres Freund <andres@anarazel.de>
Mon, 12 Jan 2026 18:22:04 +0000 (13:22 -0500)
commit0b96e734c5904ee26b8f622b3348620dda4bfee5
treef66dadcfcdb8db26120032448cc056eca78b7095
parent852558b9ec9d54194195a7b7418d57e83a2fda70
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
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam_visibility.c
src/include/access/heapam.h
src/tools/pgindent/typedefs.list