On Thu, 2026-04-02 at 18:03 -0400, Tom Lane wrote:
> and a secondary problem is that that drives the
> cost of hash_agg_check_limits to an unacceptable level.
I recall some discussion about whether the memory accounting would
recurse to child contexts at the time MemoryContextGetMemAllocated() is
called, or whether it would update the parent contexts at the time a
new block is allocated in a subcontext. Using the latter strategy would
solve the high cost when there are many subcontexts.
Regards,
Jeff Davis