Skip to content

Commit 9c9e9a7

Browse files
author
Konstantin Knizhnik
committed
Start with minimal prefetch distance to minimize prefetch overhead for exact or limited index scans
1 parent 7e3f397 commit 9c9e9a7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/access/nbtree/nbtsearch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,8 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
12421242
else if (!enable_indexscan_prefetch || !scan->heapRelation)
12431243
so->prefetch_maximum = 0; /* disable prefetch */
12441244

1245-
/* If key bounds are not specified, then we will probably scan the whole relation and it make sense to start with the largest possible prefetch distance */
1246-
so->current_prefetch_distance = (keysz == 0) ? so->prefetch_maximum : 0;
1245+
/* Start with minimal prefetch distance to minimize prefetch overhead for exact or limited index scans */
1246+
so->current_prefetch_distance = 0;
12471247

12481248
/*
12491249
* If we found no usable boundary keys, we have to start from one end of

0 commit comments

Comments
 (0)