1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

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.
This commit is contained in:
Tom Lane
2012-07-21 17:45:07 -04:00
parent ed0af33247
commit 31c7c642b6
7 changed files with 120 additions and 48 deletions

View File

@@ -55,6 +55,7 @@ extern bool contain_window_function(Node *clause);
extern WindowFuncLists *find_window_functions(Node *clause, Index maxWinRef);
extern double expression_returns_set_rows(Node *clause);
extern double tlist_returns_set_rows(List *tlist);
extern bool contain_subplans(Node *clause);

View File

@@ -35,6 +35,9 @@ extern Plan *subquery_planner(PlannerGlobal *glob, Query *parse,
bool hasRecursion, double tuple_fraction,
PlannerInfo **subroot);
extern void add_tlist_costs_to_plan(PlannerInfo *root, Plan *plan,
List *tlist);
extern bool is_dummy_plan(Plan *plan);
extern Expr *expression_planner(Expr *expr);