model-writtenrun 8963 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andrew Gierth proposed a proof of concept that computes rank() in WindowAgg and stops Limit when an input boolean becomes true, reusing Surafel Temesgen's surrounding SQL support and aiming toward PERCENT and more general stopping conditions #1.
- Surafel Temesgen demonstrated that the alternative lost backward scanning without SCROLL, required additional storage with SCROLL, and repeatedly evaluated the limit expression, potentially producing incorrect results with volatile functions #2.
- Andrew accepted the backward-scan tradeoff and proposed evaluating offset plus limit through an InitPlan, explaining that moving the transformation earlier in planning was necessary to turn the prototype into usable code #3.
- Alvaro Herrera preferred the more general design but proposed shipping Surafel's implementation if Andrew's remained unfinished; Andrew requested planner expertise and acknowledged possible performance costs, while Ryan Lambert raised performance concerns and asked whether PERCENT could be included #4 #5 #6.
- Surafel proposed proceeding with his existing implementation while leaving room for a future replacement, and Alvaro agreed at the thread's close; Andrew's prototype remained unfinished with no revised attachment #7 #8.
- The subsequent commit implemented Surafel's direct tuple-comparison approach from the later submission in thread #39571, explicitly deferring Andrew's alternative, so this thread records the design discussion and decision rather than the committed patch's source #447358 357889eb17.