optimizer cleanup

This commit is contained in:
Bruce Momjian 1999-02-18 04:55:54 +00:00
parent d977ff7b52
commit e78662d879
3 changed files with 14 additions and 12 deletions

View File

@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_eval.c,v 1.33 1999/02/16 00:40:59 momjian Exp $
* $Id: geqo_eval.c,v 1.34 1999/02/18 04:55:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -86,12 +86,12 @@ geqo_eval(Query *root, Gene *tour, int num_gene)
* gimme_tree
* this program presumes that only LEFT-SIDED TREES are considered!
*
* 'outer_rel' is the preceeding join
* 'old_rel' is the preceeding join
*
* Returns a new join relation incorporating all joins in a left-sided tree.
*/
RelOptInfo *
gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *outer_rel)
gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *old_rel)
{
RelOptInfo *inner_rel; /* current relation */
int base_rel_index;
@ -115,16 +115,16 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *out
}
else
{ /* tree main part */
if (!(new_rels = make_rels_by_clause_joins(root, outer_rel,
if (!(new_rels = make_rels_by_clause_joins(root, old_rel,
inner_rel->joininfo,
inner_rel->relids)))
{
if (!BushyPlanFlag)
new_rels = make_rels_by_clauseless_joins(outer_rel,
new_rels = make_rels_by_clauseless_joins(old_rel,
lcons(inner_rel,NIL));
else
new_rels = make_rels_by_clauseless_joins(outer_rel,
lcons(outer_rel,NIL));
new_rels = make_rels_by_clauseless_joins(old_rel,
lcons(old_rel,NIL));
}
/* process new_rel->pathlist */
@ -168,7 +168,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *out
}
return outer_rel; /* tree finished ... */
return old_rel; /* tree finished ... */
}
static RelOptInfo *

View File

@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_main.c,v 1.13 1999/02/13 23:16:08 momjian Exp $
* $Id: geqo_main.c,v 1.14 1999/02/18 04:55:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -253,7 +253,8 @@ geqo(Query *root)
best_tour = (Gene *) pool->data[0].string;
/* root->join_relation_list_ will be modified during this ! */
best_rel = (RelOptInfo *) gimme_tree(root, best_tour, 0, pool->string_length, NULL);
best_rel = (RelOptInfo *) gimme_tree(root, best_tour, 0,
pool->string_length, NULL);
/* DBG: show the query plan
print_plan(best_plan, root);

View File

@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo.h,v 1.12 1999/02/15 05:50:02 momjian Exp $
* $Id: geqo.h,v 1.13 1999/02/18 04:55:54 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -75,7 +75,8 @@ extern RelOptInfo *geqo(Query *root);
extern void geqo_params(int string_length);
extern Cost geqo_eval(Query *root, Gene *tour, int num_gene);
extern RelOptInfo *gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *outer_rel);
extern RelOptInfo *gimme_tree(Query *root, Gene *tour, int rel_count,
int num_gene, RelOptInfo *old_rel);
#endif /* GEQO_H */