model-writtenrun 7320 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Pavel Stehule reported that increasing memory made a query roughly ten times slower, with the extra time absent from individual plan-node timings #1; he identified PostgreSQL 14.2 and supplied profiles showing substantial memory-allocation overhead #3.
- Matthias van de Meent suspected swapping #5, but Pavel reported ample free RAM and said the slowdown occurred only with Memoize enabled #6; Tom Lane instead suspected an oversized Memoize hash table whose initialization and cleanup fell outside plan-node timing #8.
- David Rowley explained that a cache entry contains the results of one parameterized scan and that first encounters of distinct keys must miss the cache #10 #11; David G. Johnston then demonstrated that the hit-ratio formula mishandled limited cache capacity and supplied a corrected formula #13.
- David Rowley accepted Johnston's arithmetic correction but separated it from the reported slowdown and deferred it beyond PostgreSQL 15 because increasing estimated cache hits could destabilize join-plan choices #14.
- David Rowley requested allocation call graphs #19, and Jakub Wartak suggested additional tracing techniques #20; Pavel's profiles and debugger results ultimately showed build_hash_table() receiving a size of 4,369,066 despite the relevant outer path estimating only 91 rows #21 #22 #28.
- David Rowley traced the excessive allocation to using the parent relation's row estimate instead of the parameterized outer path's estimate #30, then attached the one-line correction and regression-output updates after confirming that existing regression queries also exposed the mistake #31.
- Justin Pryzby supported exposing Memoize hash-table sizes in EXPLAIN and suggested considering a backpatch #33; David Rowley posted that separate enhancement but explained that its added instrumentation fields changed structure sizes and offsets, creating extension compatibility concerns for stable branches #34.
- David Rowley committed the row-estimate attachment #31 unchanged as 1e731ed12a and announced its backpatch to PostgreSQL 14 #35.
- The thread ended with Pavel's thanks #36; the EXPLAIN hash-bucket enhancement remained proposed without a recorded landing #34, and the separate hit-ratio correction remained deferred within the supplied discussion #14.
- The deferred formula correction from #13 subsequently developed into the matching attachment #531074 in thread #47629 and landed on March 21, 2023 as f48b4f892f, targeting only master to avoid destabilizing stable-branch plans; attribution belongs to that later thread.