| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| 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-03-16 17:14:15 |
| Message-ID: | CAAKRu_byaXSbanJE_q0P2ngd46hQBu9jeBde72NOaKy=N83XnQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Mar 15, 2026 at 3:49 PM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
>
> - If the separation between TAM and the low-level instrumentation clear
> enough? Or is the ReadStreamInstrumentation "leaking" somewhere? For
> example, is it OK it's in SeqScanInstrumentation?
Personally, I don't like having both structs
(ReadStreamInstrumentation and TableScanStatsData).
The executor nodes (SeqScanState, BitmapHeapScanState) already embed
ReadStreamInstrumentation directly in their instrumentation structs,
so we already have a reference to the read stream in table AM-agnostic
code. Having a second identical struct means maintaining two
definitions without any actual benefit.
> But I'm sure there are other questions I haven't thought of.
I see a couple more issues with the counting in read_stream.c.
You are double-counting stalls for synchronous IO. You increment
stalls in read_stream_next_buffer() but we actually execute
synchronous IO in WaitReadBuffers and return needed_wait as true,
which will count a stall again.
You are not counting fast path IOs because those don't go through
read_stream_start_pending_read() and instead are started directly by
StartReadBuffer() in read_stream_next_buffer(). Simple diff attached
should fix this.
Also, per worker stats are not displayed when BUFFERS false is passed
even with IO true because of a small oversight. I fixed it in the
attached diff.
- Melanie
| Attachment | Content-Type | Size |
|---|---|---|
| nocfbot-0001-fixups.patch | text/x-patch | 1.5 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Melanie Plageman | 2026-03-16 17:29:21 | Re: EXPLAIN: showing ReadStream / prefetch stats |
| Previous Message | Robert Haas | 2026-03-16 17:11:16 | Re: pg_plan_advice |