model-writtenrun 4165 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- David Rowley proposed estimating how many input rows a WindowAgg must consume before producing its first row, addressing Tim Palmer's report that LIMIT queries could choose expensive nested-loop plans because startup costs were understated #1.
- Andy Fan questioned the fallback estimate #2; David explained that DEFAULT_INEQ_SEL handles unknown following bounds, but discovered that ROWS frames without ORDER BY were incorrectly treated as consuming the whole partition #3, and Andy accepted the explanation #4.
- David expanded the estimator to handle frame modes, peer groups and exclusions, adding temporary debugging output and reporting sample estimates #5.
- David withdrew the proposed PostgreSQL 16 open-item fix as the release freeze progressed and moved the work to a commitfest rather than risk late planner changes #6.
- Returning in August, David refreshed the patch, corrected exclusion handling without ORDER BY and retained the helper in costsize.c after considering selfuncs.c; he proposed committing only to master to avoid destabilizing released plans #7.
- Andy demonstrated that boundary detection requires reading an additional tuple and questioned correlated estimates and caching #8; David added the extra tuple, removed exclusion deductions because excluded rows are still read, and explained that existing statistics and path-dependent input counts limited the other proposals #9.
- Andy approved the revised patch #10, Tim supported avoiding backpatches #11, and David announced the master-only landing #12 as 3900a02c97, matching the final attachment #9 apart from formatting.
- David then committed forgotten local cleanup as 3fd19a9b23, removing the temporary DEBUG1 output, moving the startup-tuple calculation next to its use and refining a comment.
- Nathan Bossart reported 32-bit regression failures caused by swapped join inputs #13; Tom Lane reproduced them and suggested restricting one input to avoid nearly equal-cost alternatives #14.
- David added WHERE t2.two = 1 and updated the expected plan in 7516056c58, announcing the fix #15; Tom confirmed that his VM passed, leaving the work committed with no outstanding patch revisions in the thread #16.