model-writtenrun 2770 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Zhang Mingli proposed extending redundant GROUP BY removal beyond primary keys to unique NOT NULL keys, choosing the key with the fewest columns to maximize removal in #1.
- jian he tested partitioned-table behavior, identified missing cleanup and problematic handling of deferrable constraints, and questioned duplicate catalog scans in #2.
- After a long gap, David Rowley reported that catalog changes had broken the patch and identified a selection flaw that could overlook a usable primary key when a smaller unique key was absent from GROUP BY in #3.
- Peter Eisentraut raised dependency-tracking concerns in #4, and David clarified in #5 that this planner optimization could rely on relcache invalidation when indexes or NOT NULL properties changed.
- jian he supplied a substantially different pg_index-based implementation in #7, initially preferring primary keys, then fixed incorrect removal when only part of a unique key was NOT NULL in #8.
- David argued for treating primary keys and other unique indexes uniformly and simplifying candidate selection in #9; revisions through #13 implemented that approach, deterministic OID ordering, and revised tests, while leaving width-based key selection for future work.
- David replaced the catalog helper with existing RelOptInfo metadata in #14, delayed removal until query_planner() had built that metadata, moved the function into initsplan.c, and supported NULLS NOT DISTINCT indexes; #15 supplied omitted regression tests.
- Andrei Lepikhov requested a separate relocation patch in #16, while jian he independently experimented with expression-index support in #17; David split the non-expression implementation into two patches in #18.
- David rejected the expression-index experiment in #19 because it lacked expression matching and could not prove that non-null inputs produced non-null outputs, and jian he accepted the objection in #21.
- Andrei reviewed both split patches and proposed an early exit plus possible equivalence-class and DISTINCT extensions in #20, while jian he endorsed the delayed call and cached metadata design in #21.
- David committed the relocation and delayed call together as 430a5952de, taking both changes from #18 and explaining the revised commit boundary in #22.
- David committed the remaining unique-index optimization as bd10ec5297, adding an early exit when no relation had multiple grouping columns, a partial-index regression case, and editorial cleanup beyond #18.
- Both patches were landed by #22; David explained the stronger early exit and unresolved equivalence-class selection tradeoffs in #23, and Andrei confirmed in #24 that broader costing and grouping choices were ideas for future development.