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

Peter Smith <smithpb2250@gmail.com>

From: Peter Smith <smithpb2250@gmail.com>
To: Andres Freund <andres@anarazel.de>
Cc: Lukas Fittl <lukas@fittl.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-01-15T22:05:44Z
Lists: pgsql-hackers
On Sat, Jan 10, 2026 at 6:38 AM Andres Freund <andres@anarazel.de> wrote:
>
> Hi,
>
>
> On 2025-10-31 00:18:04 -0700, Lukas Fittl wrote:
> > Attached v4 patchset that addresses feedback (unless otherwise noted below)
> > and is rebased on master. Other changes:
> >
> > [...]
> > - Per our off-list conversation at PGConf.EU, added a patch (v4/0007) that
> > illustrates how the stack mechanism can be used to separate index and table
> > buffer accesses in the EXPLAIN for Index Scans
>
> Nice!
>
>
> I pushed 0001. The only changes I made were to break a few long lines.
>
>

I happened to be reading the code in this recent push [1] and saw this
new macro:

+#define INSTR_TIME_LT(x,y) \
+ ((x).ticks > (y).ticks)

Is that macro name OK? It seemed backwards to me. Shouldn't it be
called INSTR_TIME_GT because it is checking that x is "Greater Than"
y?

======
[1] https://github.com/postgres/postgres/commit/e5a5e0a90750d665cab417322b9f85c806430d85#diff-d927962e2574e803c27ea9a429eeecf7bc29c7a38c830ccb3a10e9e3da5ba357R187

Kind Regards.
Peter Smith.
Fujitsu Australia



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