Re: EXPLAIN: showing ReadStream / prefetch stats

From: Nikolay Samokhvalov <nik(at)postgres(dot)ai>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: EXPLAIN: showing ReadStream / prefetch stats
Date: 2026-09-22 19:02:56
Message-ID: CAM527d9dSPTBHEynuLH3bRR=hNb-Pj8RP=nh+LdO49ndcVsZ2A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 22, 2026 at 8:23 AM Tomas Vondra <tomas(at)vondra(dot)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.

Nik

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2026-09-22 19:13:52 Re: EXPLAIN: showing ReadStream / prefetch stats
Previous Message Manu 2026-09-22 18:56:10 Re: Fix race condition in SSI when reading PredXact->SxactGlobalXmin