Re: OOM kill during planning - pg_terminate_backend is ignored

From: Andres Freund <andres(at)anarazel(dot)de>
To: Floris Van Nee <florisvannee(at)optiver(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: OOM kill during planning - pg_terminate_backend is ignored
Date: 2026-09-02 00:05:12
Message-ID: zjfalozw4rnd5k2dbo6hatjoiedn6lc6eh65zm4xvem6kicc3b@2gpso4lsnsjk
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2026-09-01 19:53:05 +0000, Floris Van Nee wrote:
> I am not sure what the right fix is.  CHECK_FOR_INTERRUPTS() in
> expression_tree_walker_impl()/expression_tree_mutator_impl() and
> copyObjectImpl() would cover it, but those are relatively hot; an
> amortised check every N nodes would be cheaper.

I think we'd need a separation between the function to start initiating a tree
walk/mutation and the function called for every recursion level. Then we can
do the CFI() in the "start a tree walk" function, without having to do it the
expression_tree_walker_impl(), once per processed node.

> Separately, nothing bounds planner memory in aggregate, so there is no
> ceiling short of the OOM killer -- but that seems like its own thread.

That's a ginormous topic, with lots of work needed to get anywhere.

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Ian Lawrence Barwick 2026-09-01 23:54:51 Re: [PATCH] doc: clarify AS requirement when VALUES used in a FROM clause