Re: Non-deterministic buffer counts reported in execution with EXPLAIN ANALYZE BUFFERS

From: Lukas Fittl <lukas(at)fittl(dot)com>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: Radim Marek <radim(at)boringsql(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Non-deterministic buffer counts reported in execution with EXPLAIN ANALYZE BUFFERS
Date: 2026-02-03 15:44:14
Message-ID: CAP53PkxOX5ZBO76moCW=CykiwBhJSewq2UnQrLgrGwJg=Kaimg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Feb 3, 2026 at 3:02 AM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
> Perhaps we could identify buffer accesses from syscache lookups, and
> track those separately? Then we'd know which of the hits/reads are from
> "actual" execution.

Doing this in the current infrastructure (with the global
pgBufferUsage counters) is pretty expensive I think, since we'd need
to do an extra call to BufferUsageAccumDiff after syscache lookups, to
get the buffer usage just for that activity.

If splitting out buffers by syscache vs others is of interest, I would
welcome review of the stack-based instrumentation patch over at [0],
which has an example of how it can be used to more easily break Index
Scans out into index and table access - the same logic could be
applied to syscache lookups I think.

[0]: https://www.postgresql.org/message-id/flat/CAP53Pkw85U-aMRzkZ%2BkRKfCh0pA5vyo%3D_W16gPK4sirZxiJy%3DA%40mail.gmail.com#170c740dbeb87d25d3f921ab28e4bb40

Thanks,
Lukas

--
Lukas Fittl

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Adrien Nayrat 2026-02-03 15:46:38 Re: Change default of jit to off
Previous Message Nathan Bossart 2026-02-03 15:34:33 Re: Remove unused isCommit parameter from AtEOXact_LocalBuffers