Skip to content

Commit 757df1d

Browse files
authored
Adjust prefetch target for parallel bitmap scan (#273)
* Adjust prefetch target for parallel bitmap scan * More fixes for parallel bitmap scan prefetch
1 parent 9fd9794 commit 757df1d

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

src/backend/executor/nodeBitmapHeapscan.c

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,8 @@ BitmapHeapNext(BitmapHeapScanState *node)
154154
node->prefetch_request_pos = 0;
155155
if (node->prefetch_maximum > 0)
156156
{
157-
pstate->prefetch_iterator =
158-
tbm_prepare_shared_iterate(tbm);
159-
160-
/*
161-
* We don't need the mutex here as we haven't yet woke up
162-
* others.
163-
*/
164-
pstate->prefetch_pages = 0;
165-
pstate->prefetch_target = -1;
157+
node->prefetch_pages = 0;
158+
node->prefetch_target = -1;
166159
}
167160
#endif
168161

@@ -264,19 +257,8 @@ BitmapHeapNext(BitmapHeapScanState *node)
264257
* Try to prefetch at least a few pages even before we get to the
265258
* second page if we don't stop reading after the first tuple.
266259
*/
267-
if (!pstate)
268-
{
269-
if (node->prefetch_target < node->prefetch_maximum)
270-
node->prefetch_target++;
271-
}
272-
else if (pstate->prefetch_target < node->prefetch_maximum)
273-
{
274-
/* take spinlock while updating shared state */
275-
SpinLockAcquire(&pstate->mutex);
276-
if (pstate->prefetch_target < node->prefetch_maximum)
277-
pstate->prefetch_target++;
278-
SpinLockRelease(&pstate->mutex);
279-
}
260+
if (node->prefetch_target < node->prefetch_maximum)
261+
node->prefetch_target++;
280262
#endif /* USE_PREFETCH */
281263
}
282264

@@ -401,10 +383,6 @@ static inline void
401383
BitmapAdjustPrefetchTarget(BitmapHeapScanState *node)
402384
{
403385
#ifdef USE_PREFETCH
404-
/* NEON: we are not using prefetch iterator for parallel plan so no need to adjust it */
405-
if (node->pstate != NULL)
406-
return;
407-
408386
if (node->prefetch_target >= node->prefetch_maximum)
409387
/* don't increase any further */ ;
410388
else if (node->prefetch_target >= node->prefetch_maximum / 2)

0 commit comments

Comments
 (0)