model-writtenrun 9408 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tomas Vondra opened the thread with two prototypes after a severely underestimated hash join exhausted memory through unaccounted BufFile buffers: one relaxed the memory allowance to limit total consumption, while the other grouped batch files into slices with overflow files #1.
- Melanie Plageman initially preferred the simpler allowance adjustment, while Thomas Munro favored more reliable work_mem enforcement and questioned the extreme-skew detector; Tomas clarified that slicing grouped batch-file metadata rather than splitting individual batches #2 #3 #4.
- Thomas separated ineffective skew detection, the lack of a bounded-memory fallback, and unaccounted file buffers into distinct problems, while Tom Lane showed that planning already penalized oversized duplicate groups, subject to statistical accuracy #6 #9.
- Melanie's code review and assertion testing exposed an impossible overflow-allocation condition, and Tomas revised the slicing patch to fix it, repair another batch-transition bug, and clarify memory-accounting comments #11 #14.
- Melanie also proposed switching individual troublesome batches to nested-loop processing, which Tomas accepted as a way to avoid problems with already-emitted join results #12 #13.
- Testing the revised slicing patch, Melanie found an example that increased from 64 to 16384 batches and reported roughly 128 MB of memory despite 64 kB work_mem; Tomas acknowledged that overflow files could themselves exceed the limit and suspected duplicate handling or initial sizing #15 #16.
- Hubert Zhang introduced a separate patch co-authored with Ning Yu that re-enabled batch growth after later tuples made splitting useful, addressing premature permanent growth shutdown rather than BufFile accounting #17 #18.
- Tomas urged coordination among the fixes and reported that slicing lacked a known parallel-hash implementation; Melanie subsequently proposed three complementary pieces—previewing splits, slicing file metadata, and a hash block nested-loop fallback—and required parallel support or explicit disabling before acceptance #19 #20 #21.
- Robert Haas argued that splitting every batch magnified skew problems and proposed uneven, distribution-aware partitioning; Hubert developed that idea into a hash-function-chain design that would split only overflowing batches, but supplied no attached implementation of it here #22 #23.
- Melanie continued developing the block nested-loop fallback elsewhere while advocating BufFile accounting as an independent improvement, but Tomas preferred landing the fallback first and considering additional strategies afterward #25 #26.
- Tomas eventually declined immediate further work and agreed to return the patch with feedback, which Michael Paquier recorded; the thread ended with Melanie announcing a parallel-aware adaptive-hash-join prototype elsewhere that was still far from committable #28 #29 #30.
- The eventual BufFile-aware sizing change landed years later as a1b4f289be from the newer submission #583275 in thread #50838, retaining this thread as historical provenance rather than committing one of its attached prototypes.