model-writtenrun 9769 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Dmitry Marakasov reported that PostgreSQL 11 consumed gigabytes of memory for repeated subqueries combining unnest() and INTERSECT, while PostgreSQL 10 did not, and supplied a reproducer in #1.
- Tom Lane traced the growth to accumulated expression contexts in #2 and identified CreateExprContext(parent->state) in BuildTupleHashTable() as allocating outside the hash table’s reclaimable context in #5.
- Andres Freund explained that expression-based comparison required the context and proposed retaining hash tables between executions to avoid rebuilding comparator expressions, while flagging compatibility constraints for stable branches in #6.
- Andres posted four patches in #7: a standalone expression context allocated inside tablecxt, simplehash reset support, a separate metadata context exposed through BuildTupleHashTableExt(), and conversion of executor callers to reuse tables; the compatibility wrapper preserved existing external callers and reuse also addressed JIT overhead reported in thread #68745.
- The leak fix landed unchanged as 5567d12ce0, and simplehash reset support landed unchanged as 3b632a58e7, both from #7.
- The tuple-hash reset API and executor caller conversions from #7 landed unchanged apart from rebase as 317ffdfeaa and 356687bd82; Andres announced the push and upcoming minor-release inclusion in #8, asking whether master should retain the compatibility wrapper.
- After the commits, Tom questioned release-weekend timing in #9 and the future safety of omitting expression-context shutdown callbacks in #11; these comments occurred too late to qualify as pre-commit reviews.
- Andres defended the restricted comparator expressions and explained the cost of individually freeing contexts and the need to preserve external callers, reporting local valgrind testing in #10 and #12.
- The thread ended with all four patches committed and no revert shown, while Tom proposed a doubly linked expression-context list to make cleanup cheaper in #13, leaving cleanup guarantees and possible API simplification unresolved.