Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1fdb0ce

Browse files
committed
BitmapHeapScan: Use correct recheck flag for skip_fetch
As of7c70996, BitmapPrefetch() used the recheck flag forthe current block to determine whether or not it should skip prefetchingthe proposed prefetch block. As explained in the comment, this assumedthe index AM will report the same recheck value for the future page asit did for the current page - but there's no guarantee.This only affects prefetching - if the recheck flag changes, we mayprefetch blocks unecessarily and not prefetch blocks that will beneeded. But we don't need to rely on that assumption - we know therecheck flag for the block we're considering prefetching, so we canuse that.The impact is very limited in practice - the opclass would need toassign different recheck flags to different blocks, but none of thebuilt-in opclasses seems to do that.Author: Melanie PlagemanReviewed-by: Tomas Vondra, Andres Freund, Tom LaneDiscussion:https://postgr.es/m/1939305.1712415547%40sss.pgh.pa.us
1 parent04e72ed commit1fdb0ce

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

‎src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -475,14 +475,9 @@ BitmapPrefetch(BitmapHeapScanState *node, TableScanDesc scan)
475475
* skip this prefetch call, but continue to run the prefetch
476476
* logic normally. (Would it be better not to increment
477477
* prefetch_pages?)
478-
*
479-
* This depends on the assumption that the index AM will
480-
* report the same recheck flag for this future heap page as
481-
* it did for the current heap page; which is not a certainty
482-
* but is true in many cases.
483478
*/
484479
skip_fetch= (!(scan->rs_flags&SO_NEED_TUPLES)&&
485-
(node->tbmres ? !node->tbmres->recheck : false)&&
480+
!tbmpre->recheck&&
486481
VM_ALL_VISIBLE(node->ss.ss_currentRelation,
487482
tbmpre->blockno,
488483
&node->pvmbuffer));
@@ -533,7 +528,7 @@ BitmapPrefetch(BitmapHeapScanState *node, TableScanDesc scan)
533528

534529
/* As above, skip prefetch if we expect not to need page */
535530
skip_fetch= (!(scan->rs_flags&SO_NEED_TUPLES)&&
536-
(node->tbmres ? !node->tbmres->recheck : false)&&
531+
!tbmpre->recheck&&
537532
VM_ALL_VISIBLE(node->ss.ss_currentRelation,
538533
tbmpre->blockno,
539534
&node->pvmbuffer));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp