model-writtenrun 3472 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
Dec 2017 · 1 entry
- David Rowley proposed partial aggregation for string_agg and array_agg to enable parallel execution and other partial-aggregation optimizations, retaining each string state's first delimiter and recording its length in StringInfo.cursor; JSON and XML aggregates were explicitly outside the patch's scope #1.
Mar - May 2018 · 12 entries
- After David Steele reported catalog OID collisions, Rowley refreshed the OIDs, incorporated Andres Freund's suggestion to cache array element I/O metadata in fn_extra and rebased the combined patch #2 #4 #3 #5 #7.
- Tomas Vondra questioned the delimiter representation and suggested a separate state structure, but accepted Rowley's explanation that one contiguous buffer and its cursor already supplied the required information; the revisions also removed stale code, corrected an assertion and documented partial-mode support #8 #9 #10 #11 #12.
- Vondra reported successful testing, but Stephen Frost subsequently found that array aggregation copied and serialized NULL datums without checking their null flags #13 #15.
- Rowley fixed the NULL handling, discovered that string_agg returned a null pointer without marking the result SQL NULL, and replaced text encoding conversion with byte serialization shared by the text and bytea variants #18.
- Tom Lane supplied a revised patch with complete function-lookup caching, properly terminated receive buffers and NULL combine-state handling, while requesting regression coverage and raising concerns about duplicated knowledge of array-state internals #19.
- Lane also questioned whether parallel aggregation's benefits justified breaking applications that relied on implicit input ordering; Rowley, Vondra and Frost argued that ordering was already unstable and that one unsupported aggregate could prevent useful parallelism for an entire query #19 #20 #22 #24.
- Lane identified a separate correctness issue for array element types without binary send/receive functions, prompting Rowley to attach a planner safeguard #28 #34.
- Vondra and Lane rejected applying that safeguard indiscriminately to all aggregates and settled on checking the specific array serialization functions and actual argument expression types #39 #41 #42 #44.
- Rowley added parallel-versus-serial regression coverage and folded it together with Lane's implementation and the narrowed planner safeguard, then accepted Vondra's suggestion to permit by-value types without binary I/O functions #45 #46 #49 #50.
- A proposed additional check for array-valued inputs was unnecessary because those serialization functions do not call element send/receive functions, while dropping string_agg alone and changing allocation growth policy were discussed without being adopted #51 #52 #53 #54 #55.
- Robert Haas supported proceeding despite implicit-ordering concerns, and Lane acknowledged being in the minority; discussion also clarified that the implementation still processes different aggregates in matching row order #57 #58 #60 #61.
- Rowley nevertheless deferred the work pending better handling of explicitly ordered aggregates and marked it returned with feedback in June 2018 #65 #66.
Aug 2022 · 3 entries
- In August 2022, Rowley revived the patch with a rebase after planner improvements allowed presorted input for ordered aggregates, reducing the cost of requesting deterministic ordering; Lane remained skeptical about the benefit but declined to oppose proceeding strongly #67 #68.
- Zhihong Yu questioned rounding allocation sizes to powers of two, which Rowley retained to avoid repeated reallocations, and Pavel Stehule later reported successful compilation, regression tests and performance testing #70 #71 #72.
- Rowley committed the revived patch as 16fd03e956, with only loop-declaration cleanup and a catalog-version bump beyond #67, and announced the landing in #75.
Dec 2022 - Jan 2023 · 1 entry
- Rowley published scalability measurements and then corrected a benchmark-script mistake, reporting that string_agg still achieved a 6.49-fold speedup with 32 workers in the corrected run #73 #74.
Mar 2024 · 2 entries
- In March 2024, Alexander Lakhin reported intermittent failures of the added EXPLAIN test and supplied a sleep-based reproducer showing that automatic analyze changed the estimates and selected a different final aggregation plan #76.
- Rowley fixed the test by disabling autovacuum on pagg_test in d6a6957d53, backpatched the change to PostgreSQL 16 and explained that this preserved the expected plan; the thread ends with the feature and its test-stability fix committed #77.