aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeSubplan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/nodeSubplan.c')
-rw-r--r--src/backend/executor/nodeSubplan.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index 9a7962518ee..9a706df5f06 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -1303,83 +1303,3 @@ ExecReScanSetParamPlan(SubPlanState *node, PlanState *parent)
parent->chgParam = bms_add_member(parent->chgParam, paramid);
}
}
-
-
-/*
- * ExecInitAlternativeSubPlan
- *
- * Initialize for execution of one of a set of alternative subplans.
- */
-AlternativeSubPlanState *
-ExecInitAlternativeSubPlan(AlternativeSubPlan *asplan, PlanState *parent)
-{
- AlternativeSubPlanState *asstate = makeNode(AlternativeSubPlanState);
- double num_calls;
- SubPlan *subplan1;
- SubPlan *subplan2;
- Cost cost1;
- Cost cost2;
- ListCell *lc;
-
- asstate->subplan = asplan;
-
- /*
- * Initialize subplans. (Can we get away with only initializing the one
- * we're going to use?)
- */
- foreach(lc, asplan->subplans)
- {
- SubPlan *sp = lfirst_node(SubPlan, lc);
- SubPlanState *sps = ExecInitSubPlan(sp, parent);
-
- asstate->subplans = lappend(asstate->subplans, sps);
- parent->subPlan = lappend(parent->subPlan, sps);
- }
-
- /*
- * Select the one to be used. For this, we need an estimate of the number
- * of executions of the subplan. We use the number of output rows
- * expected from the parent plan node. This is a good estimate if we are
- * in the parent's targetlist, and an underestimate (but probably not by
- * more than a factor of 2) if we are in the qual.
- */
- num_calls = parent->plan->plan_rows;
-
- /*
- * The planner saved enough info so that we don't have to work very hard
- * to estimate the total cost, given the number-of-calls estimate.
- */
- Assert(list_length(asplan->subplans) == 2);
- subplan1 = (SubPlan *) linitial(asplan->subplans);
- subplan2 = (SubPlan *) lsecond(asplan->subplans);
-
- cost1 = subplan1->startup_cost + num_calls * subplan1->per_call_cost;
- cost2 = subplan2->startup_cost + num_calls * subplan2->per_call_cost;
-
- if (cost1 < cost2)
- asstate->active = 0;
- else
- asstate->active = 1;
-
- return asstate;
-}
-
-/*
- * ExecAlternativeSubPlan
- *
- * Execute one of a set of alternative subplans.
- *
- * Note: in future we might consider changing to different subplans on the
- * fly, in case the original rowcount estimate turns out to be way off.
- */
-Datum
-ExecAlternativeSubPlan(AlternativeSubPlanState *node,
- ExprContext *econtext,
- bool *isNull)
-{
- /* Just pass control to the active subplan */
- SubPlanState *activesp = list_nth_node(SubPlanState,
- node->subplans, node->active);
-
- return ExecSubPlan(activesp, econtext, isNull);
-}