pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Geoghegan <pg@bowt.ie>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: heapam: Track heap block in IndexFetchHeapData.
Date: Sat, 04 Apr 2026 15:46:47 +0000
Message-ID: <E1w93Cw-002vim-2z@gemulon.postgresql.org> (raw)

heapam: Track heap block in IndexFetchHeapData.

Add an explicit BlockNumber field (xs_blk) to IndexFetchHeapData that
tracks which heap block is currently pinned in xs_cbuf.

heapam_index_fetch_tuple now uses xs_blk to determine when buffer
switching is needed, replacing the previous approach that compared
buffer identities via ReleaseAndReadBuffer on every non-HOT-chain call.

This is preparatory work for an upcoming commit that will add index
prefetching using a read stream.  Delegating the release of a currently
pinned buffer to ReleaseAndReadBuffer won't work anymore -- at least not
when the next buffer that the scan needs to pin is one returned by
read_stream_next_buffer (not a buffer returned by ReadBuffer).

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAH2-Wz=g=JTSyDB4UtB5su2ZcvsS7VbP+ZMvvaG6ABoCb+s8Lw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c7d09595e46ff513ae0a23ae80e58871a321174f

Modified Files
--------------
src/backend/access/heap/heapam_indexscan.c | 31 ++++++++++++++++++------------
src/include/access/heapam.h                |  5 +++--
2 files changed, 22 insertions(+), 14 deletions(-)



Message-ID: <E1w93Cw-002vim-2z@gemulon.postgresql.org>
Permalink:  ../E1w93Cw-002vim-2z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w93Cw-002vim-2z@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: pg@bowt.ie, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: heapam: Track heap block in IndexFetchHeapData.
  In-Reply-To: <E1w93Cw-002vim-2z@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