model-writtenrun 8103 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane proposed moving AlternativeSubPlan selection into the planner because runtime switching had never materialized, executor support imposed overhead, and EXPLAIN showed confusing alternatives; David Rowley noted that planner-time selection could also access distinct-value estimates needed for result caching #1 #2.
- Tom Lane posted separate patches for planner-time selection and executor removal, using expression-specific execution estimates while retaining ruleutils.c printing support for possible inspection of intermediate planner trees #3.
- Andy Fan questioned subplan placement and execution counts around joins; Tom explained that targetlist evaluation must preserve error semantics and that expensive subplan qualifications would generally run late, motivating the approximate qualification execution count #4 #8 #9.
- David Rowley proposed delaying subquery plan creation; Tom rejected broad refactoring as disproportionate but revised the series to check hashability at the Path stage and null discarded subplans, avoiding unnecessary planning and executor initialization #5 #6 #7.
- David Rowley reviewed both patches, questioned the two-alternative assumption and list-access overhead, and tested a slow EXISTS case; Tom kept changes to EXISTS costing outside this patch's scope #10 #11.
- David supplied follow-up patches for arbitrary numbers of alternatives and faster list macros; Tom found incomplete discarded-plan cleanup in the generalized loop, agreed to repair it, and deferred list macros and costing to separate discussions #12 #13.
- The thread ended with Tom's commitment to push the corrected implementation, followed by 41efb83408, which combined #7 with a corrected portion of #12, credited David's review, and left the separate list-macro and costing work outside this commit.