Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bitmap scan prefetch #260

Merged
merged 2 commits into from
Feb 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/backend/executor/nodeBitmapHeapscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,8 @@ BitmapHeapNext(BitmapHeapScanState *node)
break;
}

BitmapAdjustPrefetchIterator(node, tbmres);

/*
* We can skip fetching the heap page if we don't need any fields
* from the heap, and the bitmap entries don't need rechecking,
Expand Down Expand Up @@ -366,7 +368,10 @@ BitmapAdjustPrefetchIterator(BitmapHeapScanState *node,
{
#ifdef USE_PREFETCH
TBMIterator *prefetch_iterator = node->prefetch_iterator;
Assert(node->pstate == NULL);

/* NEON: we are not using prefetch iterator for parallel plan so no need to adjust it */
if (node->pstate != NULL)
return;

if (node->prefetch_pages > 0)
{
Expand Down Expand Up @@ -396,6 +401,10 @@ static inline void
BitmapAdjustPrefetchTarget(BitmapHeapScanState *node)
{
#ifdef USE_PREFETCH
/* NEON: we are not using prefetch iterator for parallel plan so no need to adjust it */
if (node->pstate != NULL)
return;

if (node->prefetch_target >= node->prefetch_maximum)
/* don't increase any further */ ;
else if (node->prefetch_target >= node->prefetch_maximum / 2)
Expand Down