model-writtenrun 9571 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andrew Gierth opened the thread with a remote-estimation failure that made an ORDER BY LIMIT 1 query take about 150 seconds instead of 15 milliseconds, tracing it to EXPLAIN estimating a full result while execution used cursor planning #1.
- Kyotaro Horiguchi proposed reconsidering FDW cost constants #2, while Tom Lane explored LIMIT-bearing EXPLAIN requests and setting cursor_tuple_fraction, noting the expense of additional remote planning #3.
- Etsuro Fujita proposed using upper-planner pushdown to address the LIMIT case #4 and supplied two implementation patches for ORDERED and FINAL processing, leaving INSERT/UPDATE/DELETE support for future work #6.
- Early revisions reduced the grouping-sort surcharge, accounted for target-list evaluation, stopped applying bounded-sort estimates when the remote query lacked LIMIT, and corrected costing to favor useful remote LIMIT execution #8 #9 #10.
- Antonin Houska reviewed the implementation and supplied a planner-target patch #11; Etsuro explained that general cursor fast-start planning required separate work, and Antonin accepted that scope distinction #12 #14.
- Etsuro narrowed Antonin's prerequisite to saving ORDERED and DISTINCT targets in upper_targets, leaving direct reltarget assignments for future work because the array change was sufficient for the FDW implementation #13 #16 #18.
- The planner prerequisite landed as 3fdc374b5d from #18, retaining Antonin's authorship credit and Etsuro's additional DISTINCT assignment, with only commit-message editing reported at publication #20.
- The main series resumed with the LIMIT cost helper extracted into its own patch at Antonin's request, use of create_foreign_upper_path and the saved ORDERED target, and revised placement of the remote-LIMIT cost adjustment #24.
- Jeff Janes tested the earlier and revised series and found that LIMIT without ORDER BY still failed to push down with remote estimates #25; Etsuro traced this to remote EXPLAIN costs being rounded to two decimal places #26.
- Antonin questioned target-evaluation accounting, unsupported upper stages and the mixed relation perspective in estimate_path_cost_size #27 #31 #35; Etsuro explained the required target-cost differences and retained the costing interface to reuse existing scan/join estimation #30 #33 #37.
- The next revisions avoided redundant foreign paths, corrected grouping-row estimates, and addressed Jeff's LIMIT case by reusing cached costs when no final sort required another remote EXPLAIN; Etsuro then corrected an accidentally posted work-in-progress version #39 #41.
- Antonin asked how to distinguish ORDERED-stage sorting from earlier grouping-stage sorting #42, and Etsuro explained that the query's final ordering belonged at ORDERED while useful intermediate remote sorts could still serve higher operations #43.
- Etsuro subsequently simplified ORDERED processing to reuse recorded pushdown safety for base and join relations, generate new paths only for grouping relations, and move scan/join target-cost adjustment into the FINAL patch #44.
- Self-review revealed that removing unnecessary EPQ plans also removed the plan shapes exercised by existing regression tests #45; Etsuro kept the cleaner execution plans and added a separate test patch using a local table to preserve meaningful EPQ coverage #46.
- The final submission added commit messages without changing the four patch diffs #47; no independent review of the newly introduced EPQ test patch appears before the landing announcement #48.
- The ORDERED component landed with small initialization and comment cleanups as ffab494a4d, followed by the unchanged EPQ test diff as 0269edefac, both from #47.
- The unchanged cost-helper refactoring landed as aef65db676, followed by the FINAL component with an additional assertion and small cleanups as d50d172e51, completing the series from #47.
- Etsuro's last message confirms that all submitted work had landed and thanks Antonin and Jeff for reviewing #48; general cursor fast-start planning and INSERT/UPDATE/DELETE upper-stage support remained outside this series as previously stated #12 #6.