model-writtenrun 2976 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Richard Guo proposed explicit incremental sorting for partially ordered mergejoin outer inputs, leaving inner inputs on full sort because incremental sort lacks mark/restore support; he identified append and unique plans as other possibilities he had not investigated #1.
- Tomas Vondra raised concerns about costing and choosing incremental sort without comparing alternatives, while Richard's first patch adopted the existing planner convention of preferring incremental sort when presorted keys exist and the feature is enabled #2 #3.
- Richard demonstrated a mergejoin speedup, while Tomas questioned skew-related regressions and reliance on enable_incremental_sort; Richard showed that existing planner callers already used the same preference and that skew-related costing problems already existed #4 #5 #6 #7 #8.
- After discussing whether full sort could receive a lower estimated cost, Richard submitted a second version retaining the implementation while adding comments, a commit message, a mergejoin regression test, and adjustments to the existing aggregates test #10 #11.
- David Rowley challenged the commit message's claim about incremental sort performing worse under skew, and Richard clarified that this patch sorts an already selected cheapest input path rather than choosing a more expensive scan to obtain ordering #12 #13.
- Tomas supplied a uniform-data counterexample, but David traced its slowdown to scan costing and Richard demonstrated that incremental sort won when both alternatives used the same input path; Tomas accepted that distinction while retaining broader concerns about estimation and LIMIT interactions #14 #15 #16 #17.
- Richard committed the second patchset as 828e94c9d2, preserving its code and tests while revising the commit message's performance rationale, and announced the push with thanks to both reviewers #11 #18.
- The thread ends with the change landed and an unanswered late review from Andrei Lepikhov arguing that comparison counts and ordering choices can favor full sort and that both alternatives should be considered; no follow-up patch or resolution appears #19.