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

From: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
To: Lukas Fittl <lukas(at)fittl(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Peter Smith <smithpb2250(at)gmail(dot)com>
Subject: Re: Stack-based tracking of per-node WAL/buffer usage
Date: 2026-03-10 08:12:56
Message-ID: CAN4CZFNuxMqnmtujzemZ1i7hzYkaLD+BWPNq8tFXoPWp5R4How@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> ResourceOwnerForgetInstrumentation directly follows the call to
> ExecFinalizeNodeInstrumentation in standard_ExecutorFinish, so I'm not
> sure which error case you're thinking of?

There are a few pallocs between them, so OOM is possible, even if
unlikely. I mainly mentioned this because even if unlikely it can
happen in theory, and the fix seems simple to me.

> I don't think that's a permanent leak, since it would be in the memory
> context of the caller, i.e. the per-query memory context

Yes, it's definitely not permanent, but could be bad with many tuples.

> and so
> doing the ResOwner dance for each tuple is probably not ideal.

These approaches are interesting, but also add complexity, so I'm
unsure which is better for this, the pfree calls add one line and
solve the main issue with the current code.

> Basically it should be this instead, I think,
> so we correctly call the table AM's table_index_fetch_tuple again if
> call_again gets set:

Right, this code will be better.

> I don't know if the extra allocations
> really matter, but I can see your point.

Yeah, probably doesn't matter that much, but the code also wasn't that
nice in that form. I didn't try to actually modify it, but by just
looking at it the grouped option seemed cleaner to me, and the output
should also be self-explanatory and logical to users.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anders Åstrand 2026-03-10 08:37:47 Re: Change initdb default to the builtin collation provider
Previous Message Chao Li 2026-03-10 08:04:32 Re: ALTER TABLE: warn when actions do not recurse to partitions