aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/costsize.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/path/costsize.c')
-rw-r--r--src/backend/optimizer/path/costsize.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index c14692d5b97..e70d2a7abee 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -42,7 +42,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.52 2000/02/15 20:49:16 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.53 2000/03/14 02:23:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -687,8 +687,8 @@ cost_qual_eval_walker(Node *node, Cost *total)
* (We assume that sub-selects that can be executed as
* InitPlans have already been removed from the expression.)
*
- * NOTE: this logic should agree with make_subplan in
- * subselect.c.
+ * NOTE: this logic should agree with the estimates used by
+ * make_subplan() in plan/subselect.c.
*/
{
SubPlan *subplan = (SubPlan *) expr->oper;
@@ -701,16 +701,18 @@ cost_qual_eval_walker(Node *node, Cost *total)
subcost = plan->startup_cost +
(plan->total_cost - plan->startup_cost) / plan->plan_rows;
}
- else if (subplan->sublink->subLinkType == EXPR_SUBLINK)
- {
- /* assume we need all tuples */
- subcost = plan->total_cost;
- }
- else
+ else if (subplan->sublink->subLinkType == ALL_SUBLINK ||
+ subplan->sublink->subLinkType == ANY_SUBLINK)
{
/* assume we need 50% of the tuples */
subcost = plan->startup_cost +
0.50 * (plan->total_cost - plan->startup_cost);
+ /* XXX what if subplan has been materialized? */
+ }
+ else
+ {
+ /* assume we need all tuples */
+ subcost = plan->total_cost;
}
*total += subcost;
}