optimizer cleanup.

This commit is contained in:
Bruce Momjian 1999-02-14 05:27:12 +00:00
parent 808a6df065
commit d8b482be7c
2 changed files with 15 additions and 43 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.33 1999/02/14 05:14:08 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.34 1999/02/14 05:27:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -162,7 +162,7 @@ static List *
find_join_paths(Query *root, List *outer_rels, int levels_needed)
{
List *x;
List *new_rels = NIL;
List *joined_rels = NIL;
RelOptInfo *rel;
/*******************************************
@ -181,14 +181,14 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
/*
* Determine all possible pairs of relations to be joined at this
* level. Determine paths for joining these relation pairs and
* modify 'new_rels' accordingly, then eliminate redundant join
* modify 'joined_rels' accordingly, then eliminate redundant join
* relations.
*/
new_rels = make_new_rels_by_joins(root, outer_rels);
joined_rels = make_new_rels_by_joins(root, outer_rels);
update_rels_pathlist_for_joins(root, new_rels);
update_rels_pathlist_for_joins(root, joined_rels);
merge_rels_with_same_relids(new_rels);
merge_rels_with_same_relids(joined_rels);
#if 0
/*
@ -196,11 +196,11 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
* rel, * consider doing pullup -- JMH
*/
if (XfuncMode != XFUNC_NOPULL && XfuncMode != XFUNC_OFF)
foreach(x, new_rels)
foreach(x, joined_rels)
xfunc_trypullup((RelOptInfo *) lfirst(x));
#endif
rels_set_cheapest(new_rels);
rels_set_cheapest(joined_rels);
if (BushyPlanFlag)
{
@ -211,10 +211,10 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
* involves the join relation to the joininfo list of the
* other relation
*/
add_new_joininfos(root, new_rels, outer_rels);
add_new_joininfos(root, joined_rels, outer_rels);
}
foreach(x, new_rels)
foreach(x, joined_rels)
{
rel = (RelOptInfo *) lfirst(x);
@ -239,20 +239,20 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
/*
* merge join rels if then contain the same list of base rels
*/
outer_rels = merge_joinrels(new_rels, outer_rels);
outer_rels = merge_joinrels(joined_rels, outer_rels);
root->join_rel_list = outer_rels;
}
else
root->join_rel_list = new_rels;
root->join_rel_list = joined_rels;
if (!BushyPlanFlag)
outer_rels = new_rels;
outer_rels = joined_rels;
}
if (BushyPlanFlag)
return final_join_rels(outer_rels);
else
return new_rels;
return joined_rels;
}
/*****************************************************************************

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.24 1999/02/14 04:56:46 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.25 1999/02/14 05:27:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -66,8 +66,6 @@ update_rels_pathlist_for_joins(Query *root, List *joinrels)
{
List *mergeinfo_list = NIL;
List *hashinfo_list = NIL;
List *temp_list = NIL;
List *path = NIL;
List *j;
foreach(j, joinrels)
@ -144,37 +142,11 @@ update_rels_pathlist_for_joins(Query *root, List *joinrels)
* 4. Consider paths where both outer and inner relations must be
* hashed before being joined.
*/
pathlist = add_pathlist(joinrel, pathlist,
hash_inner_and_outer(joinrel, outerrel,
innerrel, hashinfo_list));
joinrel->pathlist = pathlist;
/*
* 'OuterJoinCost is only valid when calling
* (match_unsorted_inner) with the same arguments as the previous
* invokation of (match_unsorted_outer), so clear the field before
* going on.
*/
temp_list = innerrel->pathlist;
foreach(path, temp_list)
{
/*
* XXX
*
* This gross hack is to get around an apparent optimizer bug on
* Sparc (or maybe it is a bug of ours?) that causes really
* wierd behavior.
*/
if (IsA_JoinPath(path))
((Path *) lfirst(path))->outerjoincost = (Cost) 0;
/*
* do it iff it is a join path, which is not always true, esp
* since the base level
*/
}
}
}