Re: Stack-based tracking of per-node WAL/buffer usage

Tomas Vondra <tomas@vondra.me>

From: Tomas Vondra <tomas@vondra.me>
To: Lukas Fittl <lukas@fittl.com>, Zsolt Parragi <zsolt.parragi@percona.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Andres Freund <andres@anarazel.de>
Cc: Peter Smith <smithpb2250@gmail.com>
Date: 2026-03-16T23:50:40Z
Lists: pgsql-hackers
On 3/14/26 21:49, Lukas Fittl wrote:
> ...
> 
> Implemented this fix in IndexNext, and also expanded the tracking of
> table access to IndexNextWithReorder.
> 
> Regarding Index-Only Scans, I did not add instrumentation for table
> access yet - I might add that in a follow-up revision or we could also
> do it in a follow-on patch.
> 

I think we should, and it probably should be done in the same commit as
for plain index scans. Mostly for consistency / less confusion.

Every now and then there's an index-only scan that has to do a lot of
heap fetches, possibly just as many as the plain index scan. But the IOS
version would not say how many buffer accesses are for table, and users
might assume an index-only scan does not access table. Confusing.


I only started to look at the patch today, so I don't have any real
review comments. But I noticed the pg_session_buffer_usage is added only
to the contrib/meson.build and not to the Makefile. I assume that's not
intentional.

regards

-- 
Tomas Vondra




Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. instrumentation: Allocate query level instrumentation in ExecutorStart

  2. instrumentation: Move ExecProcNodeInstr to allow inlining

  3. instrumentation: Separate per-node logic from other uses

  4. instrumentation: Separate trigger logic from other uses

  5. instrumentation: Rename INSTR_TIME_LT macro to INSTR_TIME_GT

  6. instrumentation: Keep time fields as instrtime, convert in callers