Cost cleanup.

This commit is contained in:
Bruce Momjian 1997-12-18 12:21:02 +00:00
parent 6b00ec3713
commit d3f0e87d17
3 changed files with 29 additions and 46 deletions

View File

@ -52,7 +52,7 @@ planner()
if a join from the join clause adds only one relation, do the join
or find_clauseless_joins()
find_all_join_paths()
generate paths(nested,mergesort) for joins found in find_join_rels()
generate paths(nested,sortmerge) for joins found in find_join_rels()
prune_joinrels()
remove from the join list the relation we just added to each join
prune_rel_paths()

View File

@ -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;

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: planmain.h,v 1.6 1997/11/26 01:13:48 momjian Exp $
* $Id: planmain.h,v 1.7 1997/12/18 12:21:02 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -21,8 +21,7 @@
/*
* prototypes for plan/planmain.c
*/
extern Plan *
query_planner(Query *root,
extern Plan *query_planner(Query *root,
int command_type, List *tlist, List *qual);
@ -30,15 +29,12 @@ query_planner(Query *root,
* prototypes for plan/createplan.c
*/
extern Plan *create_plan(Path *best_path);
extern SeqScan *
make_seqscan(List *qptlist, List *qpqual, Index scanrelid,
extern SeqScan *make_seqscan(List *qptlist, List *qpqual, Index scanrelid,
Plan *lefttree);
extern Sort *
make_sort(List *tlist, Oid tempid, Plan *lefttree,
extern Sort *make_sort(List *tlist, Oid tempid, Plan *lefttree,
int keycount);
extern Agg *make_agg(List *tlist, int nagg, Aggreg **aggs);
extern Group *
make_group(List *tlist, bool tuplePerGroup, int ngrp,
extern Agg *make_agg(List *tlist, int nagg, Aggreg **aggs, Plan *lefttree);
extern Group *make_group(List *tlist, bool tuplePerGroup, int ngrp,
AttrNumber *grpColIdx, Sort *lefttree);
extern Unique *make_unique(List *tlist, Plan *lefttree, char *uniqueAttr);
extern List *generate_fjoin(List *tlist);
@ -56,11 +52,9 @@ extern void add_missing_vars_to_base_rels(Query *root, List *tlist);
* prototypes for plan/setrefs.c
*/
extern void set_tlist_references(Plan *plan);
extern List *
join_references(List *clauses, List *outer_tlist,
extern List *join_references(List *clauses, List *outer_tlist,
List *inner_tlist);
extern List *
index_outerjoin_references(List *inner_indxqual,
extern List *index_outerjoin_references(List *inner_indxqual,
List *outer_tlist, Index inner_relid);
extern void set_result_tlist_references(Result *resultNode);
extern void set_agg_tlist_references(Agg *aggNode);