model-writtenrun 7158 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
May - Jun 2018 · 4 entries
- Teodor Sigaev proposed reordering GROUP BY keys by distinct-value estimates and existing input orderings in #1, explicitly leaving GROUPING SETS optimization for separate work.
- Tomas Vondra's review in #3 distinguished exploiting index order from statistical reordering and highlighted comparison costs, correlated data and unnecessary extra sorts, prompting the split in #4.
- Teodor replaced independent column-cardinality sorting with greedy prefix estimates in #6, while Claudio Freire argued for comparator-aware costing and retaining the original ordering as a candidate in #8.
- The revisions through #22 added experimental controls, but Tomas maintained that reliable costing was necessary in #24, and Gavin Flower proposed bounding permutation exploration in #29.
Apr - May 2019 · 1 entry
- After a long gap, Dmitry Dolgov resumed development in #33, separated tests and removed duplicated ORDER BY matching, then incorporated width and comparison-function costs in #35.
May - Jun 2020 · 1 entry
- Tomas supplied a separate incremental-sort prototype in #41 and argued that planning must retain several useful orderings because a locally cheaper grouping can harm later operations; Robert Haas supported that approach in #44.
Oct 2020 · 1 entry
- Pavel Borisov revived the older statistical implementation with PostgreSQL 13 integration in #46, while discussion in #50 called for combining efforts around alternative paths and separating basic functionality from advanced costing.
Mar 2021 · 1 entry
- Ibrar Ahmed fixed a regression-table cleanup failure in #53, after which Tomas's detailed review in #55 identified suspicious FDW plans and again required multiple grouping alternatives.
Jul 2021 · 1 entry
- Tomas implemented the multiple-ordering architecture in #57 and corrected bounded-sort costing in #59, undoing the suspicious postgres_fdw LIMIT-pushdown regressions.
Jan - Mar 2022 · 3 entries
- Andrei Lepikhov's reviews in #61 and #64 improved group-size bounds and bounded heapsort estimates, which were incorporated through #66.
- Tomas replaced experimental controls with enable_group_by_reordering and prepared documentation in #68, then folded in Zhihong Yu's review and excluded the demonstration-only component in #70.
- The first implementation landed unchanged from #70 as db0d67db24, with Tomas reporting additional review and Valgrind-backed checks in #71; this March 2022 final patch supersedes the December 2021 source claimed by thread #42884.
Jul - Sep 2022 · 3 entries
- David Rowley found that the changed costs had silently made intended parallel aggregation tests serial in #73, and supplied the parallel_setup_cost repair in #78.
- That repair landed unchanged on the development branch as 2fe6b2a806, with 01474f5698 representing the same change on PostgreSQL 15 rather than a separate lineage verdict.
- David also identified obsolete preprocessing documentation in #72 and fixed it directly from the discussion as 78a9af1a27, announcing the correction in #86.
Jul 2023 · 2 entries
- The original optimization and follow-on fixes were subsequently reverted before PostgreSQL 15's release, as quoted in #87, with unreliable comparison costs and cardinality estimates still identified as unresolved problems in #88.
- Andrei restarted the work in July 2023 with #87, adapting it to newer aggregation optimizations and carrying the statistical implementation through #97.
Dec 2023 - Feb 2024 · 10 entries
- Alexander Korotkov requested a prerequisite sorting refactor in #98, while Tom Lane argued in #101 and #103 that matching available orderings was supportable but the proposed comparison-cost model was not.
- Andrei consequently removed cost-driven permutation selection in #106 and split the remaining work into a sorting-helper prerequisite and an ordering-matching feature in #109.
- Alexander's revisions through #117 incorporated additional tests, including Andrei's merge-join case for equivalence-class sort references, before Richard Guo and Alena Rybakina reviewed ordering checks and code structure in #122 and #121.
- The final preparation in #126 deduplicated alternative orderings and removed redundant ordinary GROUP BY preprocessing while retaining grouping-set handling.
- The two components of #126 landed without code edits as 7ab80ac1ca, extracting make_ordered_path(), and 0452b461bc, enabling alternative grouping orderings.
- Nathan Bossart's buildfarm report in #127 exposed an index-name collision, which Alexander fixed directly from the discussion in b91f918708.
- Tom Lane then reported unstable pg_class statistics in #133, and Andrei's replacement test in #135 landed unchanged apart from rebased context as e1b7fde418.
- Richard Guo separately revised oversized and inconsistent regression tests in #136, and Alexander reduced their data further to 100 rows in #139.
- Maxim Orlov demonstrated bulk-extension instability and proposed VACUUM ANALYZE in #140, but the eventual test revision instead retained ANALYZE with smaller data and justified its plan stability in #143.
- Richard's final test revision in #141 added missing EXPLAIN coverage and removed the now-redundant replacement test, landing unchanged as 874d817baa after Andrei's testing in #142.
Apr - Jun 2024 · 9 entries
- Tom's broader post-commit review in #145 questioned the benefit versus planning overhead and identified equivalence-class mutation, uncertain clause invariants, stale preprocessing documentation and the vague PathKeyInfo name.
- Andrei answered with the asymmetry fix in #147, invariant and duplicate-handling work in #148, a comment repair in #149 and a renaming delta in #150.
- Performance examples from jian he in #154 and Andrei in #153 demonstrated useful index, merge-join and low-memory cases, while Alexander proposed restoring preprocessing and reducing three candidate orderings to two in #155.
- jian he's investigation in #160 and #162 showed that different presorted prefixes could receive identical costs, and Andrei concluded in #161 that resolving this properly required broader sort-cost modeling.
- Alexander assembled the fixes and restored preprocess_groupclause() in #163, then separated speculative duplicate-clause handling after Andrei questioned its necessity in #164 and #166.
- jian he's review delta in #168 led to a grammar correction and an assertion replacing an error, while Alexander declined broader loop refactoring to keep the restored function close to its previous form in #169.
- Pavel Borisov reviewed every component in #170, and Alexander corrected an accidentally repeated attachment with the final comment fixes in #172.
- Four unchanged components of #172 subsequently landed as 199012a3d8 for explicit ec_sortref initialization, 91143c03d4 for invariants, 0c1af2c35c for GroupByOrdering naming and 505c008ca3 for restored preprocessing.
- At the last message, #172, duplicate-clause handling remained attached but deferred under the decision in #171, because no reachable duplicate case or demonstrated failure justified it; broader cardinality and sort-cost questions also remained open.