You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Commit85e5e22, which added (a forerunner of) this logic,argued that Adding the necessary complexity to make this work doesn't seem like it would be repaid in significantly better plans, because in cases where such a PHV exists, there is probably a corresponding join order constraint that would allow a good plan to be found without using the star-schema exception.The flaw in this claim is that there may be other join-orderrestrictions that prevent us from finding a join order that doesn'tinvolve a "dangerous" PHV. In particular we now recognize thatsmall join_collapse_limit or from_collapse_limit could prevent it.Therefore, let's bite the bullet and make the case work.We don't have to extend the executor's support for nestloop parametersas I thought at the time, because we can instead push the evaluationof the placeholder's expression into the left-hand input of theNestLoop node. So there's not really a lot of downside to thissolution, and giving the planner more join-order flexibility shouldhave value beyond just avoiding failure.Having said that, there surely is a nonzero risk of introducingnew bugs. Since this failure mode escaped detection for ten years,such cases don't seem common enough to justify a lot of risk.Therefore, let's put this fix into master but leave the back branchesalone (for now anyway).Bug: #18953Reported-by: Alexander Lakhin <exclusion@gmail.com>Diagnosed-by: Richard Guo <guofenglinux@gmail.com>Author: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/18953-1c9883a9d4afeb30@postgresql.org