model-writtenrun 9298 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andreas Seltenreich reported that batches of updates against a partitioned table exhausted MessageContext memory in #1; David Rowley supplied diagnostic instrumentation in #2, and Julian Schauder clarified that reproducing the problem required sending all statements in one batch in #3.
- Discussion distinguished the longstanding accumulation of planning memory across statements from partitioning-specific costs: Amit Langote explained the amplification from partitioned updates in #5, while Tom Lane proposed a separate child context for each statement instead of scattered frees in #9.
- Amit implemented temporary planning contexts in #11, initially copying completed plans into MessageContext and deleting temporary memory before execution; Tom deferred the longstanding issue to the next CommitFest rather than treating it as a PostgreSQL 12 release blocker in #13.
- Julien Rouhaud requested equivalent handling for extension scripts and clearer comments in #15, which Amit incorporated in #16; Julien then judged additional BuildCachedPlan handling unnecessary for prepared statements and questionable for SPI in #17, leaving that path outside the patch.
- Tom measured approximately a two-percent performance loss and objected to unconditional plan copying and context creation in #18; Amit responded in #19 by retaining the context through execution, eliminating plan copies, and skipping child contexts for the last or only statement, with new benchmarks showing little degradation.
- Kyotaro Horiguchi questioned why the shorter context lifetime was safe in #20, highlighting the need to explain why statement data could be discarded after execution.
- Tom committed #19 as b5810de3f4 with clearer comments and further extension-script changes: every statement now gets a child context, and ProcessUtility executes inside it so its temporary allocations are reclaimed too, as explained in #21.
- Amit accepted the committed changes in #22 and explained the context-lifetime reasoning to Kyotaro in #23; the implementation had landed, with only the invitation to identify any remaining lifetime concern unanswered at the thread's end.