summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2012-07-21 21:45:15 +0000
committerTom Lane2012-07-21 21:45:15 +0000
commit641054ad7882a701cf3ac4c5666f6ee59103d3a7 (patch)
tree4dfa6889904b4df2d59c67a6630b70c291c8218c /src/include
parentc6c6f2192dfd7d4e77bd00b698feef284ddabfaa (diff)
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.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/optimizer/clauses.h1
-rw-r--r--src/include/optimizer/planner.h3
2 files changed, 4 insertions, 0 deletions
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index 1713b70400e..ac75bd4d6ea 100644
--- a/src/include/optimizer/clauses.h
+++ b/src/include/optimizer/clauses.h
@@ -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);
diff --git a/src/include/optimizer/planner.h b/src/include/optimizer/planner.h
index 1f0993b5195..af0c817a43d 100644
--- a/src/include/optimizer/planner.h
+++ b/src/include/optimizer/planner.h
@@ -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);