Account for SRFs in targetlists in planner rowcount estimates.
Tom Lane <tgl@sss.pgh.pa.us>
Account for SRFs in targetlists in planner rowcount estimates. We made use of the ROWS estimate for set-returning functions used in FROM, but not for those used in SELECT targetlists; which is a bit of an oversight considering there are common usages that require the latter approach. Improve that. (I had initially thought it might be worth folding this into cost_qual_eval, but after investigation concluded that that wouldn't be very helpful, so just do it separately.) Per complaint from David Johnston. Back-patch to 9.2, but not further, for fear of destabilizing plan choices in existing releases.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/optimizer/path/costsize.c | modified | +8 −1 |
| src/backend/optimizer/plan/createplan.c | modified | +10 −19 |
| src/backend/optimizer/plan/planagg.c | modified | +2 −4 |
| src/backend/optimizer/plan/planner.c | modified | +57 −21 |
| src/backend/optimizer/util/clauses.c | modified | +39 −3 |
| src/include/optimizer/clauses.h | modified | +1 −0 |
| src/include/optimizer/planner.h | modified | +3 −0 |