model-writtenrun 4344 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Feb - May 2023 ยท 17 entries
- Jehan-Guillaume de Rorthais opened the thread with a PostgreSQL 11 query exhausting memory while ExecutorState grew to roughly 13 GB, asking whether hash-join execution was leaking memory #1.
- Tomas Vondra guided debugger-based investigation and identified the potential cost of a million batches with separate buffered files; Jehan-Guillaume then confirmed that the buffers were allocated in ExecutorState and that batch growth had stopped after expanding from 32 to 1,048,576 batches #4 #9 #13 #14.
- Tomas explained that changing the allocation context would improve diagnosis but would not itself prevent excessive memory consumption, and pointed back to earlier proposals for buffer accounting and memory rebalancing #15.
- Jehan-Guillaume surveyed the earlier dedicated-context, rebalancing, overflow-file, adaptive/block-nested-loop, and uneven-batching proposals; Tomas and Melanie Plageman supported landing the independently useful context improvement while pursuing the larger algorithm changes separately #21 #23 #25 #27 #28.
- Jehan-Guillaume revived Tomas's older context patch, initially wrapping individual save calls and emitting memory warnings; Tomas's review led to passing the context into ExecHashJoinSaveTuple(), and subsequent revisions placed it under hashCxt and removed premature diagnostic output #30 #31 #32 #34 #35.
- The work expanded into a four-patch series containing Melanie's older hash-join documentation, the dedicated context, debugging instrumentation, and experimental memory balancing that accounted for BufFile buffers and raised the memory allowance before further batch splitting #36.
- Jehan-Guillaume's measurements suggested that buffer accounting substantially reduced memory use in his artificial workload, but the best balancing factor and accurate memory reporting remained unresolved #37.
- Konstantin Knizhnik reported that the four-patch series did not reduce his parallel hash-join workload's roughly 1.3 GB per-process footprint, then supplied an additional workaround limiting batch creation while acknowledging that it still exceeded work_mem #38 #40.
- Melanie's review identified missing parallel hash-join coverage and recommended moving shared-tuplestore accessors and file buffers into the dedicated context; Jehan-Guillaume implemented those changes in a narrowed two-patch series containing documentation and allocation-context changes #41 #42.
- Melanie proposed the name spillCxt and reviewed allocation boundaries and context lifetimes; Jehan-Guillaume adopted that name, moved PrepareTempTablespaces() outside the spill context, and clarified the handling of single-batch parallel joins #43 #44.
- The reviewers agreed that the dedicated context was useful on its own, while additional EXPLAIN reporting, warning thresholds, and changes to buffer accounting needed separate work because they could alter batching behavior or required further design #45 #46 #47 #48 #53.
- Tomas's documentation review prompted an explicit algorithm reference, a simpler hash-join heading, and clearer context-parentage wording across the next revisions #46 #49 #50 #51.
- Melanie supplied commit-message drafts and detailed lifetime and wording corrections; Jehan-Guillaume incorporated them, passed the hashtable directly to ExecHashJoinSaveTuple(), removed the unresolved documentation TODO, and isolated existing indentation corrections in their own patch #52 #54.
- Following Melanie's final review, Jehan-Guillaume clarified why the save function still accepts an inner-or-outer file pointer and reordered the indentation patch; Melanie explicitly approved the resulting final series #55 #56 #57.
- Tomas committed the documentation from #56 as 507615fc53, adding a fuller paper citation, and committed its dedicated spill-context change as 8c4040edf4 with light comment and code-presentation edits #58.
- Tomas declined the standalone indentation patch, and Tom Lane noted that the main PostgreSQL 16 pgindent run was imminent; the committed scope therefore remained documentation and improved memory attribution, with batch-growth remedies and further observability work left for PostgreSQL 17 development #58 #59.
- The thread ended with Jehan-Guillaume thanking Melanie and Tomas for review and committing the changes, with no further patch submission or post-commit bug report #60.