pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: BitmapHeapScan: Use correct recheck flag for skip_fetch
Date: Sat, 06 Apr 2024 22:51:39 +0000
Message-ID: <E1rtEst-000sHA-Ef@gemulon.postgresql.org> (raw)

BitmapHeapScan: Use correct recheck flag for skip_fetch

As of 7c70996ebf0949b142a9, BitmapPrefetch() used the recheck flag for
the current block to determine whether or not it should skip prefetching
the proposed prefetch block. As explained in the comment, this assumed
the index AM will report the same recheck value for the future page as
it did for the current page - but there's no guarantee.

This only affects prefetching - if the recheck flag changes, we may
prefetch blocks unecessarily and not prefetch blocks that will be
needed. But we don't need to rely on that assumption - we know the
recheck flag for the block we're considering prefetching, so we can
use that.

The impact is very limited in practice - the opclass would need to
assign different recheck flags to different blocks, but none of the
built-in opclasses seems to do that.

Author: Melanie Plageman
Reviewed-by: Tomas Vondra, Andres Freund, Tom Lane
Discussion: https://postgr.es/m/1939305.1712415547%40sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1fdb0ce9b10970a4b02f1ef0c269e2c1fbbecd25

Modified Files
--------------
src/backend/executor/nodeBitmapHeapscan.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)



Message-ID: <E1rtEst-000sHA-Ef@gemulon.postgresql.org>
Permalink:  ../E1rtEst-000sHA-Ef@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rtEst-000sHA-Ef@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: tomas.vondra@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: BitmapHeapScan: Use correct recheck flag for skip_fetch
  In-Reply-To: <E1rtEst-000sHA-Ef@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