model-writtenrun 2767 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Richard Guo demonstrated that unnecessary PlaceHolderVars forced a lateral inner join into a nested-loop plan and proposed tracking the lowest nullable join side so simple Vars could avoid wrapping safely, initially leaving complex expressions out of scope #1.
- James Coleman approved the approach and suggested clearer comments and ordered test output; after discussing whether ordering was necessary, Richard incorporated comment changes but retained unordered tests because correctness did not require ordering and nearby tests used the same convention #2 #3 #4 #5.
- Richard extended the same optimization to existing PlaceHolderVars and added regression coverage in January 2024, then returned in June with a rebase and clearer explanations of why eliminating these wrappers allows better join plans #6 #7.
- Dmitry Dolgov approved the implementation and requested more precise wording about nullability; Richard clarified the comments, completed context initialization, and raised the possibility of extending the optimization to strict non-Var expressions #8 #9.
- wenhui qiu reported successful testing and suggested adding a case with multiple nested subqueries #10.
- Richard replaced explicit nullable-side tracking with subset checks using newly available nullingrel_info, moved and ordered the regression tests, and deferred optimization of more complex expressions to a separate patch #11.
- Andrei Lepikhov found the reworked code sound but requested negative tests demonstrating cases where PlaceHolderVar wrapping remains necessary #12.
- Richard committed #11 as f64ec81a81 with unchanged optimizer code and two added negative tests, then confirmed the push in the thread's final message #13; the Var/PHV optimization landed without backpatching because it changes plans, while complex-expression optimization remained separate future work #11.