On 12/17/25 20:30, Andres Freund wrote:
> Hi,
> 
> On 2025-12-17 13:49:43 -0500, Peter Geoghegan wrote:
>> On Wed, Dec 17, 2025 at 12:19 PM Konstantin Knizhnik <[email protected]> 
>> wrote:
>>> Moreover with `enable_indexscan_prefetch=off` results are the same.
>>
>> It's quite unlikely that the current heuristics that trigger
>> prefetching would have ever allowed any prefetching, for queries such
>> as these.
>>
>> The exact rule right now is that we don't even begin prefetching until
>> we've already read at least one index leaf page, and have to read
>> another one. So it's impossible to use prefetching with a LIMIT of 1,
>> with queries such as these. It's highly unlikely that you'd see any
>> benefits from prefetching even with LIMIT 100 (usually we wouldn't
>> even begin prefetching).
> 
> Note that due to the tuple size and fillfactor in Konstantin's workload, there
> will be one tuple per page... That should allow for some prefetching.
> 

Yes, but that's in the heap. The mechanism Peter described is about leaf
pages in the index, and the index has the usual fillfactor. So there'll
be many index entries per leaf.


regards

-- 
Tomas Vondra



Reply via email to