model-writtenrun 1498 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Haowu Ge reported that upgrading from PostgreSQL 16 to 18 caused GROUP BY ROLLUP queries over views to use full table scans, with severe production slowdowns #1.
- Richard Guo traced the regression to PlaceHolderVars introduced to preserve grouping-set expression identity, considered restricting where those wrappers were inserted, and instead proposed looking through them during index matching #2 #3.
- Haowu Ge found that the first patch did not fix the reported query, and Richard Guo identified interleaved RelabelType nodes and deeply nested PlaceHolderVars as cases requiring recursive stripping #4 #5.
- Richard Guo introduced a lightweight detection walker followed by a conditional mutator, avoiding unnecessary copying and an ABI-breaking change to match_index_to_operand(), and confirmed that the revised patch fixed the original example on master and PostgreSQL 18 #6 #8.
- Haowu Ge's broader partitioned-table example still selected unsuitable indexes, leading Richard Guo to add a separate statistics-lookup patch that strips all PlaceHolderVars during estimation while retaining stricter checks for index execution correctness #9 #10.
- Haowu Ge confirmed the earlier example was fixed but reported another failure involving joins inside a view; Richard Guo traced it to the requirement that a PlaceHolderVar's syntactic scope exactly match the indexed relation #11 #12.
- Richard Guo removed the syntactic-scope restriction while retaining the nullability check, added regression coverage for the join case, and added a statistics fast path for queries without PlaceHolderVars; Haowu Ge then confirmed successful example and production testing #13 #14.
- Richard Guo weighed the risk of changing stable-branch query plans against leaving a severe regression unresolved, and Tom Lane supported back-patching to PostgreSQL 18 because applications migrating from earlier releases should retain working index access #15 #16.
- The final series #13 landed as the unchanged index-operands patch ad66f705fa and the statistics patch with comment-only refinements 559f9e90db.
- Richard Guo closed the thread by confirming that both patches had been pushed and back-patched to PostgreSQL 18, with the fix expected in the February minor release and no remaining patches identified as pending #17.