agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Melanie Plageman <melanieplageman@gmail.com>
Subject: [PATCH v4 04/14] BitmapPrefetch use prefetch block recheck for skip fetch
Date: Mon, 12 Feb 2024 19:03:24 -0500
As of 7c70996ebf0949b142a9, BitmapPrefetch() used the recheck flag for
the current block to determine whether or not it could skip prefetching
the proposed prefetch block. It makes more sense for it to use the
recheck flag from the TBMIterateResult for the prefetch block instead.
See this [1] thread on hackers reporting the issue.
[1] https://www.postgresql.org/message-id/CAAKRu_bxrXeZ2rCnY8LyeC2Ls88KpjWrQ%2BopUrXDRXdcfwFZGA%40mail.g...
---
src/backend/executor/nodeBitmapHeapscan.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/src/backend/executor/nodeBitmapHeapscan.c b/src/backend/executor/nodeBitmapHeapscan.c
index 2e4f87ea3a3..35ef26221ba 100644
--- a/src/backend/executor/nodeBitmapHeapscan.c
+++ b/src/backend/executor/nodeBitmapHeapscan.c
@@ -484,15 +484,9 @@ BitmapPrefetch(BitmapHeapScanState *node, TableScanDesc scan)
* skip this prefetch call, but continue to run the prefetch
* logic normally. (Would it be better not to increment
* prefetch_pages?)
- *
- * This depends on the assumption that the index AM will
- * report the same recheck flag for this future heap page as
- * it did for the current heap page; which is not a certainty
- * but is true in many cases.
*/
-
skip_fetch = (scan->rs_flags & SO_CAN_SKIP_FETCH &&
- (node->tbmres ? !node->tbmres->recheck : false) &&
+ !tbmpre->recheck &&
VM_ALL_VISIBLE(node->ss.ss_currentRelation,
tbmpre->blockno,
&node->pvmbuffer));
@@ -543,7 +537,7 @@ BitmapPrefetch(BitmapHeapScanState *node, TableScanDesc scan)
/* As above, skip prefetch if we expect not to need page */
skip_fetch = (scan->rs_flags & SO_CAN_SKIP_FETCH &&
- (node->tbmres ? !node->tbmres->recheck : false) &&
+ !tbmpre->recheck &&
VM_ALL_VISIBLE(node->ss.ss_currentRelation,
tbmpre->blockno,
&node->pvmbuffer));
--
2.37.2
--5aaqsqqhbq27q3qo
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment;
filename="v4-0005-Update-BitmapAdjustPrefetchIterator-parameter-typ.patch"
view thread (23+ messages) latest in thread
Message-ID: <no-message-id-1840300@localhost>
Permalink: ../no-message-id-1840300@localhost/
Also on: postgresql.org/message-id/no-message-id-1840300@localhost
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-hackers@postgresql.org
Cc: melanieplageman@gmail.com
Subject: Re: [PATCH v4 04/14] BitmapPrefetch use prefetch block recheck for skip fetch
In-Reply-To: <no-message-id-1840300@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox