Re: EXPLAIN: showing ReadStream / prefetch stats

From: Andres Freund <andres(at)anarazel(dot)de>
To: Lukas Fittl <lukas(at)fittl(dot)com>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: EXPLAIN: showing ReadStream / prefetch stats
Date: 2026-04-07 15:09:40
Message-ID: sr5bcs5g73675iqxqc7g62yud6jplcyayzdeumh6ne5qvk64iu@gct7k5v2upnb
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-04-07 01:00:28 -0700, Lukas Fittl wrote:
> Btw, in that same test, when I re-run I get Prefetch but not I/O -- why is that?
>
> Seq Scan on organizations (cost=0.00..7.42 rows=1 width=483) (actual
> time=0.034..0.042 rows=1.00 loops=1)
> Filter: (slug = 'pganalyze'::text)
> Rows Removed by Filter: 113
> Prefetch: avg=1.00 max=1 capacity=94
> Buffers: shared hit=6
>
> (if its all buffers hit, why are there any prefetches at all?)

It's not really prefetching, which is visible as the distance being 1. The
read stream is created at the start of the scan, not at the first miss.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2026-04-07 15:27:00 Re: EXPLAIN: showing ReadStream / prefetch stats
Previous Message Andres Freund 2026-04-07 14:55:53 Re: Add errdetail() with PID and UID about source of termination signal