model-writtenrun 5021 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- David Rowley proposed letting window-function support routines choose cheaper frame options after Erwin Brandstetter identified unnecessary peer-row checks for row_number(), initially implementing a narrowly conditional RANGE-to-ROWS conversion #1.
- Vik Fearing explained that row_number() semantics permit unconditional frame replacement, and Erwin supplied supporting cross-database evidence; David adopted this reasoning, added rank() and dense_rank(), and generalized the request name to allow future optimizations #2 #3 #4.
- Zhihong Yu suggested a shared constant for repeated frame-option flags, but David preferred explicit definitions in each implementation and rejected placing implementation details in supportnodes.h; Zhihong accepted that decision #5 #9 #10.
- Erwin proposed broad frame-variation testing, Tom Lane cautioned that tests could not prove frame independence, and David favored code inspection supplemented by testing while identifying percent_rank() as another candidate #6 #7 #8.
- David extended the patch with support routines for percent_rank(), cume_dist(), and ntile() #11.
- Vik demonstrated that optimized equivalent windows still produced two WindowAgg passes, prompting David to add WindowClause deduplication and reassign the affected window functions #12 #13.
- David also considered letting support routines identify irrelevant ordering properties to enable broader window sharing, but left that idea out because he doubted enough queries would benefit #13.
- David committed the final attachment with comment cleanup, a catalog-version bump, and regression tests for deduplication and preservation of frame-sensitive aggregate behavior as ed1a88ddac, then announced completion #13 #14.
- The thread ended with the submitted work committed and Vik thanking David for the improvement #15.