|
|
|
@ -7,7 +7,7 @@ |
|
|
|
|
* |
|
|
|
|
* |
|
|
|
|
* IDENTIFICATION |
|
|
|
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.17 1997/12/18 03:03:35 momjian Exp $ |
|
|
|
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.18 1997/12/18 12:20:30 momjian Exp $ |
|
|
|
|
* |
|
|
|
|
*------------------------------------------------------------------------- |
|
|
|
|
*/ |
|
|
|
@ -46,44 +46,33 @@ |
|
|
|
|
static List *switch_outer(List *clauses); |
|
|
|
|
static Scan *create_scan_node(Path *best_path, List *tlist); |
|
|
|
|
static Join *create_join_node(JoinPath *best_path, List *tlist); |
|
|
|
|
static SeqScan * |
|
|
|
|
create_seqscan_node(Path *best_path, List *tlist, |
|
|
|
|
static SeqScan *create_seqscan_node(Path *best_path, List *tlist, |
|
|
|
|
List *scan_clauses); |
|
|
|
|
static IndexScan * |
|
|
|
|
create_indexscan_node(IndexPath *best_path, List *tlist, |
|
|
|
|
static IndexScan *create_indexscan_node(IndexPath *best_path, List *tlist, |
|
|
|
|
List *scan_clauses); |
|
|
|
|
static NestLoop * |
|
|
|
|
create_nestloop_node(JoinPath *best_path, List *tlist, |
|
|
|
|
static NestLoop *create_nestloop_node(JoinPath *best_path, List *tlist, |
|
|
|
|
List *clauses, Plan *outer_node, List *outer_tlist, |
|
|
|
|
Plan *inner_node, List *inner_tlist); |
|
|
|
|
static MergeJoin * |
|
|
|
|
create_mergejoin_node(MergePath *best_path, List *tlist, |
|
|
|
|
static MergeJoin *create_mergejoin_node(MergePath *best_path, List *tlist, |
|
|
|
|
List *clauses, Plan *outer_node, List *outer_tlist, |
|
|
|
|
Plan *inner_node, List *inner_tlist); |
|
|
|
|
static HashJoin * |
|
|
|
|
create_hashjoin_node(HashPath *best_path, List *tlist, |
|
|
|
|
static HashJoin *create_hashjoin_node(HashPath *best_path, List *tlist, |
|
|
|
|
List *clauses, Plan *outer_node, List *outer_tlist, |
|
|
|
|
Plan *inner_node, List *inner_tlist); |
|
|
|
|
static Node *fix_indxqual_references(Node *clause, Path *index_path); |
|
|
|
|
static Temp * |
|
|
|
|
make_temp(List *tlist, List *keys, Oid *operators, |
|
|
|
|
static Temp *make_temp(List *tlist, List *keys, Oid *operators, |
|
|
|
|
Plan *plan_node, int temptype); |
|
|
|
|
static IndexScan * |
|
|
|
|
make_indexscan(List *qptlist, List *qpqual, Index scanrelid, |
|
|
|
|
List *indxid, List *indxqual); |
|
|
|
|
static NestLoop * |
|
|
|
|
make_nestloop(List *qptlist, List *qpqual, Plan *lefttree, |
|
|
|
|
static IndexScan *make_indexscan(List *qptlist, List *qpqual, Index scanrelid, |
|
|
|
|
List *indxid, List *indxqual, Cost cost); |
|
|
|
|
static NestLoop *make_nestloop(List *qptlist, List *qpqual, Plan *lefttree, |
|
|
|
|
Plan *righttree); |
|
|
|
|
static HashJoin * |
|
|
|
|
make_hashjoin(List *tlist, List *qpqual, |
|
|
|
|
static HashJoin *make_hashjoin(List *tlist, List *qpqual, |
|
|
|
|
List *hashclauses, Plan *lefttree, Plan *righttree); |
|
|
|
|
static Hash *make_hash(List *tlist, Var *hashkey, Plan *lefttree); |
|
|
|
|
static MergeJoin * |
|
|
|
|
make_mergesort(List *tlist, List *qpqual, |
|
|
|
|
static MergeJoin *make_mergesort(List *tlist, List *qpqual, |
|
|
|
|
List *mergeclauses, Oid opcode, Oid *rightorder, |
|
|
|
|
Oid *leftorder, Plan *righttree, Plan *lefttree); |
|
|
|
|
static Material * |
|
|
|
|
make_material(List *tlist, Oid tempid, Plan *lefttree, |
|
|
|
|
static Material *make_material(List *tlist, Oid tempid, Plan *lefttree, |
|
|
|
|
int keycount); |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -415,9 +404,8 @@ create_indexscan_node(IndexPath *best_path, |
|
|
|
|
qpqual, |
|
|
|
|
lfirsti(best_path->path.parent->relids), |
|
|
|
|
best_path->indexid, |
|
|
|
|
fixed_indxqual); |
|
|
|
|
|
|
|
|
|
scan_node->scan.plan.cost = best_path->path.path_cost; |
|
|
|
|
fixed_indxqual, |
|
|
|
|
best_path->path.path_cost); |
|
|
|
|
|
|
|
|
|
return (scan_node); |
|
|
|
|
} |
|
|
|
@ -960,12 +948,13 @@ make_indexscan(List *qptlist, |
|
|
|
|
List *qpqual, |
|
|
|
|
Index scanrelid, |
|
|
|
|
List *indxid, |
|
|
|
|
List *indxqual) |
|
|
|
|
List *indxqual, |
|
|
|
|
Cost cost) |
|
|
|
|
{ |
|
|
|
|
IndexScan *node = makeNode(IndexScan); |
|
|
|
|
Plan *plan = &node->scan.plan; |
|
|
|
|
|
|
|
|
|
plan->cost = 0.0; |
|
|
|
|
plan->cost = cost; |
|
|
|
|
plan->state = (EState *) NULL; |
|
|
|
|
plan->targetlist = qptlist; |
|
|
|
|
plan->qual = qpqual; |
|
|
|
@ -1117,11 +1106,11 @@ make_material(List *tlist, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Agg * |
|
|
|
|
make_agg(List *tlist, int nagg, Aggreg **aggs) |
|
|
|
|
make_agg(List *tlist, int nagg, Aggreg **aggs, Plan *lefttree) |
|
|
|
|
{ |
|
|
|
|
Agg *node = makeNode(Agg); |
|
|
|
|
|
|
|
|
|
node->plan.cost = 0.0; |
|
|
|
|
node->plan.cost = (lefttree ? lefttree->cost : 0); |
|
|
|
|
node->plan.state = (EState *) NULL; |
|
|
|
|
node->plan.qual = NULL; |
|
|
|
|
node->plan.targetlist = tlist; |
|
|
|
|