Re: EXPLAIN: showing ReadStream / prefetch stats - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: EXPLAIN: showing ReadStream / prefetch stats
Date
Msg-id c343af3b-3d9b-48c1-9545-bd5c01929376@vondra.me
Whole thread
In response to Re: EXPLAIN: showing ReadStream / prefetch stats  (Nikolay Samokhvalov <nik@postgres.ai>)
List pgsql-hackers
On 9/22/26 21:02, Nikolay Samokhvalov wrote:
> On Tue, Sep 22, 2026 at 8:23 AM Tomas Vondra <tomas@vondra.me> wrote:
>> It's not clear to me why this would be desirable. The query execution
>> clearly *does* perform the I/O, even if the buffers end up not being
>> used. Hiding that would be very confusing / misleading.
>>
>> In other words, I/O and buffers may disagree - that's not a bug. Those
>> counters are tracking different things.
> 
> Thanks all. Agreed that issued I/O should remain accounted for.
> 
> Is Prefetch avg/max also intended to include buffers discarded by
> read_stream_reset()? If so, agreed, the patch is wrong. The comment above
> read_stream_count_prefetch() says it is called once per buffer returned
> to the consumer.
> 

Yeah, that's a good point. The comment is misleading. I didn't consider
that read_stream_next_buffer() is called from _reset() when I wrote it.

Will think how to clarify it.


regards

-- 
Tomas Vondra




pgsql-hackers by date:

Previous
From: Nikolay Samokhvalov
Date:
Subject: Re: EXPLAIN: showing ReadStream / prefetch stats
Next
From: Merlin Moncure
Date:
Subject: Up to 50x degradation in dblink performance when receiving notice traffic 19 vs 18