1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-15 03:41:20 +03:00

Rename Rel to RelOptInfo.

This commit is contained in:
Bruce Momjian
1998-07-18 04:22:52 +00:00
parent 3a132e9d83
commit 584f9438ca
38 changed files with 295 additions and 295 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.16 1998/06/15 19:28:38 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.17 1998/07/18 04:22:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -105,7 +105,7 @@ static void
find_rel_paths(Query *root, List *rels)
{
List *temp;
Rel *rel;
RelOptInfo *rel;
List *lastpath;
foreach(temp, rels)
@@ -114,7 +114,7 @@ find_rel_paths(Query *root, List *rels)
List *rel_index_scan_list;
List *or_index_scan_list;
rel = (Rel *) lfirst(temp);
rel = (RelOptInfo *) lfirst(temp);
sequential_scan_list = lcons(create_seqscan_path(rel),
NIL);
@@ -175,7 +175,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
{
List *x;
List *new_rels = NIL;
Rel *rel;
RelOptInfo *rel;
/*******************************************
* genetic query optimizer entry point *
@@ -183,7 +183,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
*******************************************/
if ((_use_geqo_) && length(root->base_relation_list_) >= _use_geqo_rels_)
return lcons(geqo(root), NIL); /* returns *one* Rel, so lcons it */
return lcons(geqo(root), NIL); /* returns *one* RelOptInfo, so lcons it */
/*******************************************
* rest will be deprecated in case of GEQO *
@@ -212,7 +212,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
*/
if (XfuncMode != XFUNC_NOPULL && XfuncMode != XFUNC_OFF)
foreach(x, new_rels)
xfunc_trypullup((Rel *) lfirst(x));
xfunc_trypullup((RelOptInfo *) lfirst(x));
#endif
prune_rel_paths(new_rels);
@@ -231,7 +231,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
foreach(x, new_rels)
{
rel = (Rel *) lfirst(x);
rel = (RelOptInfo *) lfirst(x);
if (rel->size <= 0)
rel->size = compute_rel_size(rel);
rel->width = compute_rel_width(rel);
@@ -399,7 +399,7 @@ print_path(Query *root, Path *path, int indent)
}
static void
debug_print_rel(Query *root, Rel *rel)
debug_print_rel(Query *root, RelOptInfo *rel)
{
List *l;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.8 1998/06/15 19:28:39 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.9 1998/07/18 04:22:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -95,12 +95,12 @@ product_selec(List *clauseinfo_list)
void
set_rest_relselec(Query *root, List *rel_list)
{
Rel *rel;
RelOptInfo *rel;
List *x;
foreach(x, rel_list)
{
rel = (Rel *) lfirst(x);
rel = (RelOptInfo *) lfirst(x);
set_rest_selec(root, rel->clauseinfo);
}
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.21 1998/06/15 19:28:39 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.22 1998/07/18 04:22:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -360,7 +360,7 @@ cost_hashjoin(Cost outercost,
* Returns the size.
*/
int
compute_rel_size(Rel *rel)
compute_rel_size(RelOptInfo *rel)
{
Cost temp;
int temp1;
@@ -383,7 +383,7 @@ compute_rel_size(Rel *rel)
* Returns the width of the tuple as a fixnum.
*/
int
compute_rel_width(Rel *rel)
compute_rel_width(RelOptInfo *rel)
{
return (compute_targetlist_width(get_actual_tlist(rel->targetlist)));
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.16 1998/06/15 19:28:40 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.17 1998/07/18 04:22:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,22 +42,22 @@
static void
match_index_orclauses(Rel *rel, Rel *index, int indexkey,
match_index_orclauses(RelOptInfo *rel, RelOptInfo *index, int indexkey,
int xclass, List *clauseinfo_list);
static bool
match_index_to_operand(int indexkey, Expr *operand,
Rel *rel, Rel *index);
RelOptInfo *rel, RelOptInfo *index);
static List *
match_index_orclause(Rel *rel, Rel *index, int indexkey,
match_index_orclause(RelOptInfo *rel, RelOptInfo *index, int indexkey,
int xclass, List *or_clauses, List *other_matching_indices);
static List *
group_clauses_by_indexkey(Rel *rel, Rel *index,
group_clauses_by_indexkey(RelOptInfo *rel, RelOptInfo *index,
int *indexkeys, Oid *classes, List *clauseinfo_list);
static List *
group_clauses_by_ikey_for_joins(Rel *rel, Rel *index,
group_clauses_by_ikey_for_joins(RelOptInfo *rel, RelOptInfo *index,
int *indexkeys, Oid *classes, List *join_cinfo_list, List *restr_cinfo_list);
static CInfo *
match_clause_to_indexkey(Rel *rel, Rel *index, int indexkey,
match_clause_to_indexkey(RelOptInfo *rel, RelOptInfo *index, int indexkey,
int xclass, CInfo *clauseInfo, bool join);
static bool
pred_test(List *predicate_list, List *clauseinfo_list,
@@ -67,17 +67,17 @@ static bool one_pred_clause_expr_test(Expr *predicate, Node *clause);
static bool one_pred_clause_test(Expr *predicate, Node *clause);
static bool clause_pred_clause_test(Expr *predicate, Node *clause);
static List *
indexable_joinclauses(Rel *rel, Rel *index,
indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
List *joininfo_list, List *clauseinfo_list);
static List *
index_innerjoin(Query *root, Rel *rel,
List *clausegroup_list, Rel *index);
index_innerjoin(Query *root, RelOptInfo *rel,
List *clausegroup_list, RelOptInfo *index);
static List *
create_index_paths(Query *root, Rel *rel, Rel *index,
create_index_paths(Query *root, RelOptInfo *rel, RelOptInfo *index,
List *clausegroup_list, bool join);
static List *add_index_paths(List *indexpaths, List *new_indexpaths);
static bool function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index);
static bool SingleAttributeIndex(Rel *index);
static bool function_index_operand(Expr *funcOpnd, RelOptInfo *rel, RelOptInfo *index);
static bool SingleAttributeIndex(RelOptInfo *index);
/* If Spyros can use a constant PRS2_BOOL_TYPEID, I can use this */
#define BOOL_TYPEID ((Oid) 16)
@@ -110,14 +110,14 @@ static bool SingleAttributeIndex(Rel *index);
*/
List *
find_index_paths(Query *root,
Rel *rel,
RelOptInfo *rel,
List *indices,
List *clauseinfo_list,
List *joininfo_list)
{
List *scanclausegroups = NIL;
List *scanpaths = NIL;
Rel *index = (Rel *) NULL;
RelOptInfo *index = (RelOptInfo *) NULL;
List *joinclausegroups = NIL;
List *joinpaths = NIL;
List *retval = NIL;
@@ -125,7 +125,7 @@ find_index_paths(Query *root,
if (indices == NIL)
return (NULL);
index = (Rel *) lfirst(indices);
index = (RelOptInfo *) lfirst(indices);
retval = find_index_paths(root,
rel,
@@ -235,8 +235,8 @@ find_index_paths(Query *root,
*
*/
static void
match_index_orclauses(Rel *rel,
Rel *index,
match_index_orclauses(RelOptInfo *rel,
RelOptInfo *index,
int indexkey,
int xclass,
List *clauseinfo_list)
@@ -273,8 +273,8 @@ match_index_orclauses(Rel *rel,
static bool
match_index_to_operand(int indexkey,
Expr *operand,
Rel *rel,
Rel *index)
RelOptInfo *rel,
RelOptInfo *index)
{
/*
@@ -311,8 +311,8 @@ match_index_to_operand(int indexkey,
* match the third, g,h match the fourth, etc.
*/
static List *
match_index_orclause(Rel *rel,
Rel *index,
match_index_orclause(RelOptInfo *rel,
RelOptInfo *index,
int indexkey,
int xclass,
List *or_clauses,
@@ -393,8 +393,8 @@ match_index_orclause(Rel *rel,
*
*/
static List *
group_clauses_by_indexkey(Rel *rel,
Rel *index,
group_clauses_by_indexkey(RelOptInfo *rel,
RelOptInfo *index,
int *indexkeys,
Oid *classes,
List *clauseinfo_list)
@@ -455,8 +455,8 @@ group_clauses_by_indexkey(Rel *rel,
*
*/
static List *
group_clauses_by_ikey_for_joins(Rel *rel,
Rel *index,
group_clauses_by_ikey_for_joins(RelOptInfo *rel,
RelOptInfo *index,
int *indexkeys,
Oid *classes,
List *join_cinfo_list,
@@ -578,8 +578,8 @@ group_clauses_by_ikey_for_joins(Rel *rel,
*
*/
static CInfo *
match_clause_to_indexkey(Rel *rel,
Rel *index,
match_clause_to_indexkey(RelOptInfo *rel,
RelOptInfo *index,
int indexkey,
int xclass,
CInfo *clauseInfo,
@@ -1102,7 +1102,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
*
*/
static List *
indexable_joinclauses(Rel *rel, Rel *index,
indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
List *joininfo_list, List *clauseinfo_list)
{
JInfo *joininfo = (JInfo *) NULL;
@@ -1176,7 +1176,7 @@ extract_restrict_clauses(List *clausegroup)
*
*/
static List *
index_innerjoin(Query *root, Rel *rel, List *clausegroup_list, Rel *index)
index_innerjoin(Query *root, RelOptInfo *rel, List *clausegroup_list, RelOptInfo *index)
{
List *clausegroup = NIL;
List *cg_list = NIL;
@@ -1262,8 +1262,8 @@ index_innerjoin(Query *root, Rel *rel, List *clausegroup_list, Rel *index)
*/
static List *
create_index_paths(Query *root,
Rel *rel,
Rel *index,
RelOptInfo *rel,
RelOptInfo *index,
List *clausegroup_list,
bool join)
{
@@ -1308,7 +1308,7 @@ add_index_paths(List *indexpaths, List *new_indexpaths)
}
static bool
function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index)
function_index_operand(Expr *funcOpnd, RelOptInfo *rel, RelOptInfo *index)
{
Oid heapRelid = (Oid) lfirsti(rel->relids);
Func *function;
@@ -1368,7 +1368,7 @@ function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index)
}
static bool
SingleAttributeIndex(Rel *index)
SingleAttributeIndex(RelOptInfo *index)
{
/*

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.6 1998/06/15 19:28:40 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.7 1998/07/18 04:22:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,18 +31,18 @@
static Path *best_innerjoin(List *join_paths, List *outer_relid);
static List *
sort_inner_and_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel,
sort_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
List *mergeinfo_list);
static List *
match_unsorted_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel,
match_unsorted_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
List *outerpath_list, Path *cheapest_inner, Path *best_innerjoin,
List *mergeinfo_list);
static List *
match_unsorted_inner(Rel *joinrel, Rel *outerrel, Rel *innerrel,
match_unsorted_inner(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
List *innerpath_list, List *mergeinfo_list);
static bool EnoughMemoryForHashjoin(Rel *hashrel);
static bool EnoughMemoryForHashjoin(RelOptInfo *hashrel);
static List *
hash_inner_and_outer(Rel *joinrel, Rel *outerrel, Rel *innerrel,
hash_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, RelOptInfo *innerrel,
List *hashinfo_list);
/*
@@ -76,11 +76,11 @@ find_all_join_paths(Query *root, List *joinrels)
while (joinrels != NIL)
{
Rel *joinrel = (Rel *) lfirst(joinrels);
RelOptInfo *joinrel = (RelOptInfo *) lfirst(joinrels);
List *innerrelids;
List *outerrelids;
Rel *innerrel;
Rel *outerrel;
RelOptInfo *innerrel;
RelOptInfo *outerrel;
Path *bestinnerjoin;
List *pathlist = NIL;
@@ -238,9 +238,9 @@ best_innerjoin(List *join_paths, List *outer_relids)
* Returns a list of mergesort paths.
*/
static List *
sort_inner_and_outer(Rel *joinrel,
Rel *outerrel,
Rel *innerrel,
sort_inner_and_outer(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
List *mergeinfo_list)
{
List *ms_list = NIL;
@@ -316,9 +316,9 @@ sort_inner_and_outer(Rel *joinrel,
* Returns a list of possible join path nodes.
*/
static List *
match_unsorted_outer(Rel *joinrel,
Rel *outerrel,
Rel *innerrel,
match_unsorted_outer(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
List *outerpath_list,
Path *cheapest_inner,
Path *best_innerjoin,
@@ -469,9 +469,9 @@ match_unsorted_outer(Rel *joinrel,
* Returns a list of possible merge paths.
*/
static List *
match_unsorted_inner(Rel *joinrel,
Rel *outerrel,
Rel *innerrel,
match_unsorted_inner(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
List *innerpath_list,
List *mergeinfo_list)
{
@@ -565,7 +565,7 @@ match_unsorted_inner(Rel *joinrel,
}
static bool
EnoughMemoryForHashjoin(Rel *hashrel)
EnoughMemoryForHashjoin(RelOptInfo *hashrel)
{
int ntuples;
int tupsize;
@@ -599,9 +599,9 @@ EnoughMemoryForHashjoin(Rel *hashrel)
* Returns a list of hashjoin paths.
*/
static List *
hash_inner_and_outer(Rel *joinrel,
Rel *outerrel,
Rel *innerrel,
hash_inner_and_outer(RelOptInfo *joinrel,
RelOptInfo *outerrel,
RelOptInfo *innerrel,
List *hashinfo_list)
{
HInfo *xhashinfo = (HInfo *) NULL;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.10 1998/06/15 19:28:40 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.11 1998/07/18 04:22:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,18 +31,18 @@ bool _use_right_sided_plans_ = false;
#endif
static List *find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list);
static List *find_clauseless_joins(Rel *outer_rel, List *inner_rels);
static Rel *init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo);
static List *find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list);
static List *find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels);
static RelOptInfo *init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo);
static List *
new_join_tlist(List *tlist, List *other_relids,
int first_resdomno);
static List *new_joininfo_list(List *joininfo_list, List *join_relids);
static void add_superrels(Rel *rel, Rel *super_rel);
static bool nonoverlap_rels(Rel *rel1, Rel *rel2);
static void add_superrels(RelOptInfo *rel, RelOptInfo *super_rel);
static bool nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2);
static bool nonoverlap_sets(List *s1, List *s2);
static void
set_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel,
set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel,
JInfo *jinfo);
/*
@@ -67,7 +67,7 @@ find_join_rels(Query *root, List *outer_rels)
foreach(r, outer_rels)
{
Rel *outer_rel = (Rel *) lfirst(r);
RelOptInfo *outer_rel = (RelOptInfo *) lfirst(r);
if (!(joins = find_clause_joins(root, outer_rel, outer_rel->joininfo)))
{
@@ -99,7 +99,7 @@ find_join_rels(Query *root, List *outer_rels)
* Returns a list of new join relations.
*/
static List *
find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list)
{
List *join_list = NIL;
List *i = NIL;
@@ -107,7 +107,7 @@ find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
foreach(i, joininfo_list)
{
JInfo *joininfo = (JInfo *) lfirst(i);
Rel *rel;
RelOptInfo *rel;
if (!joininfo->inactive)
{
@@ -158,16 +158,16 @@ find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
* Returns a list of new join relations.
*/
static List *
find_clauseless_joins(Rel *outer_rel, List *inner_rels)
find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels)
{
Rel *inner_rel;
RelOptInfo *inner_rel;
List *t_list = NIL;
List *temp_node = NIL;
List *i = NIL;
foreach(i, inner_rels)
{
inner_rel = (Rel *) lfirst(i);
inner_rel = (RelOptInfo *) lfirst(i);
if (nonoverlap_rels(inner_rel, outer_rel))
{
temp_node = lcons(init_join_rel(outer_rel,
@@ -192,10 +192,10 @@ find_clauseless_joins(Rel *outer_rel, List *inner_rels)
*
* Returns the new join relation node.
*/
static Rel *
init_join_rel(Rel *outer_rel, Rel *inner_rel, JInfo *joininfo)
static RelOptInfo *
init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *joininfo)
{
Rel *joinrel = makeNode(Rel);
RelOptInfo *joinrel = makeNode(RelOptInfo);
List *joinrel_joininfo_list = NIL;
List *new_outer_tlist;
List *new_inner_tlist;
@@ -396,19 +396,19 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xjoinrel, joinrels)
{
Rel *joinrel = (Rel *) lfirst(xjoinrel);
RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
foreach(xrelid, joinrel->relids)
{
Relid relid = (Relid) lfirst(xrelid);
Rel *rel = get_join_rel(root, relid);
RelOptInfo *rel = get_join_rel(root, relid);
add_superrels(rel, joinrel);
}
}
foreach(xjoinrel, joinrels)
{
Rel *joinrel = (Rel *) lfirst(xjoinrel);
RelOptInfo *joinrel = (RelOptInfo *) lfirst(xjoinrel);
foreach(xjoininfo, joinrel->joininfo)
{
@@ -421,7 +421,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xrelid, other_rels)
{
Relid relid = (Relid) lfirst(xrelid);
Rel *rel = get_join_rel(root, relid);
RelOptInfo *rel = get_join_rel(root, relid);
List *super_rels = rel->superrels;
List *xsuper_rel = NIL;
JInfo *new_joininfo = makeNode(JInfo);
@@ -436,7 +436,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach(xsuper_rel, super_rels)
{
Rel *super_rel = (Rel *) lfirst(xsuper_rel);
RelOptInfo *super_rel = (RelOptInfo *) lfirst(xsuper_rel);
if (nonoverlap_rels(super_rel, joinrel))
{
@@ -471,7 +471,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
}
foreach(xrel, outerrels)
{
Rel *rel = (Rel *) lfirst(xrel);
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
rel->superrels = NIL;
}
@@ -499,7 +499,7 @@ final_join_rels(List *join_rel_list)
*/
foreach(xrel, join_rel_list)
{
Rel *rel = (Rel *) lfirst(xrel);
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
List *xjoininfo = NIL;
bool final = true;
@@ -533,7 +533,7 @@ final_join_rels(List *join_rel_list)
* Modifies the superrels field of rel
*/
static void
add_superrels(Rel *rel, Rel *super_rel)
add_superrels(RelOptInfo *rel, RelOptInfo *super_rel)
{
rel->superrels = lappend(rel->superrels, super_rel);
}
@@ -548,7 +548,7 @@ add_superrels(Rel *rel, Rel *super_rel)
* Returns non-nil if rel1 and rel2 do not overlap.
*/
static bool
nonoverlap_rels(Rel *rel1, Rel *rel2)
nonoverlap_rels(RelOptInfo *rel1, RelOptInfo *rel2)
{
return (nonoverlap_sets(rel1->relids, rel2->relids));
}
@@ -569,7 +569,7 @@ nonoverlap_sets(List *s1, List *s2)
}
static void
set_joinrel_size(Rel *joinrel, Rel *outer_rel, Rel *inner_rel, JInfo *jinfo)
set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptInfo *inner_rel, JInfo *jinfo)
{
int ntuples;
float selec;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.6 1998/06/15 19:28:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.7 1998/07/18 04:22:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,11 +32,11 @@
static void
best_or_subclause_indices(Query *root, Rel *rel, List *subclauses,
best_or_subclause_indices(Query *root, RelOptInfo *rel, List *subclauses,
List *indices, List *examined_indexids, Cost subcost, List *selectivities,
List **indexids, Cost *cost, List **selecs);
static void
best_or_subclause_index(Query *root, Rel *rel, Expr *subclause,
best_or_subclause_index(Query *root, RelOptInfo *rel, Expr *subclause,
List *indices, int *indexid, Cost *cost, Cost *selec);
@@ -52,7 +52,7 @@ best_or_subclause_index(Query *root, Rel *rel, Expr *subclause,
*/
List *
create_or_index_paths(Query *root,
Rel *rel, List *clauses)
RelOptInfo *rel, List *clauses)
{
List *t_list = NIL;
@@ -157,7 +157,7 @@ create_or_index_paths(Query *root,
*/
static void
best_or_subclause_indices(Query *root,
Rel *rel,
RelOptInfo *rel,
List *subclauses,
List *indices,
List *examined_indexids,
@@ -212,7 +212,7 @@ best_or_subclause_indices(Query *root,
*/
static void
best_or_subclause_index(Query *root,
Rel *rel,
RelOptInfo *rel,
Expr *subclause,
List *indices,
int *retIndexid, /* return value */
@@ -224,7 +224,7 @@ best_or_subclause_index(Query *root,
Datum value;
int flag = 0;
Cost subcost;
Rel *index = (Rel *) lfirst(indices);
RelOptInfo *index = (RelOptInfo *) lfirst(indices);
AttrNumber attno = (get_leftop(subclause))->varattno;
Oid opno = ((Oper *) subclause->oper)->opno;
bool constant_on_right = non_null((Expr *) get_rightop(subclause));

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.14 1998/06/15 19:28:41 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.15 1998/07/18 04:22:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@
#include "utils/elog.h"
static List *prune_joinrel(Rel *rel, List *other_rels);
static List *prune_joinrel(RelOptInfo *rel, List *other_rels);
/*
* prune-joinrels--
@@ -44,7 +44,7 @@ prune_joinrels(List *rel_list)
* deleted
*/
foreach(i, rel_list)
lnext(i) = prune_joinrel((Rel *) lfirst(i), lnext(i));
lnext(i) = prune_joinrel((RelOptInfo *) lfirst(i), lnext(i));
}
/*
@@ -59,14 +59,14 @@ prune_joinrels(List *rel_list)
*
*/
static List *
prune_joinrel(Rel *rel, List *other_rels)
prune_joinrel(RelOptInfo *rel, List *other_rels)
{
List *i = NIL;
List *result = NIL;
foreach(i, other_rels)
{
Rel *other_rel = (Rel *) lfirst(i);
RelOptInfo *other_rel = (RelOptInfo *) lfirst(i);
if (same(rel->relids, other_rel->relids))
{
@@ -96,12 +96,12 @@ prune_rel_paths(List *rel_list)
List *x = NIL;
List *y = NIL;
Path *path = NULL;
Rel *rel = (Rel *) NULL;
RelOptInfo *rel = (RelOptInfo *) NULL;
JoinPath *cheapest = (JoinPath *) NULL;
foreach(x, rel_list)
{
rel = (Rel *) lfirst(x);
rel = (RelOptInfo *) lfirst(x);
rel->size = 0;
foreach(y, rel->pathlist)
{
@@ -130,7 +130,7 @@ prune_rel_paths(List *rel_list)
*
*/
Path *
prune_rel_path(Rel *rel, Path *unorderedpath)
prune_rel_path(RelOptInfo *rel, Path *unorderedpath)
{
Path *cheapest = set_cheapest(rel, rel->pathlist);
@@ -165,7 +165,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
foreach(xrel, rel_list1)
{
Rel *rel = (Rel *) lfirst(xrel);
RelOptInfo *rel = (RelOptInfo *) lfirst(xrel);
rel_list2 = prune_joinrel(rel, rel_list2);
}
@@ -187,7 +187,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
List *
prune_oldrels(List *old_rels)
{
Rel *rel;
RelOptInfo *rel;
List *joininfo_list,
*xjoininfo,
*i,
@@ -195,7 +195,7 @@ prune_oldrels(List *old_rels)
foreach(i, old_rels)
{
rel = (Rel *) lfirst(i);
rel = (RelOptInfo *) lfirst(i);
joininfo_list = rel->joininfo;
if (joininfo_list == NIL)

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.15 1998/06/15 19:28:42 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.16 1998/07/18 04:22:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,7 +57,7 @@ xfunc_card_unreferenced(Query *queryInfo,
*/
void
xfunc_trypullup(Rel rel)
xfunc_trypullup(RelOptInfo rel)
{
LispValue y; /* list ptr */
CInfo maxcinfo; /* The CInfo to pull up, as calculated by
@@ -242,7 +242,7 @@ xfunc_shouldpull(Query *queryInfo,
/*
* * we've left an expensive restriction below a join. Since *
* we may pullup this restriction in predmig.c, we'd best *
* set the Rel of this join to be unpruneable
* set the RelOptInfo of this join to be unpruneable
*/
set_pruneable(get_parent(parentpath), false);
/* and fall through */
@@ -256,8 +256,8 @@ xfunc_shouldpull(Query *queryInfo,
** xfunc_pullup --
** move clause from child pathnode to parent pathnode. This operation
** makes the child pathnode produce a larger relation than it used to.
** This means that we must construct a new Rel just for the childpath,
** although this Rel will not be added to the list of Rels to be joined up
** This means that we must construct a new RelOptInfo just for the childpath,
** although this RelOptInfo will not be added to the list of Rels to be joined up
** in the query; it's merely a parent for the new childpath.
** We also have to fix up the path costs of the child and parent.
**
@@ -272,7 +272,7 @@ xfunc_pullup(Query *queryInfo,
int clausetype) /* whether clause to pull is join or local */
{
Path newkid;
Rel newrel;
RelOptInfo newrel;
Cost pulled_selec;
Cost cost;
CInfo newinfo;
@@ -294,7 +294,7 @@ xfunc_pullup(Query *queryInfo,
}
/*
* * give the new child path its own Rel node that reflects the * lack
* * give the new child path its own RelOptInfo node that reflects the * lack
* of the pulled-up predicate
*/
pulled_selec = compute_clause_selec(queryInfo,
@@ -400,7 +400,7 @@ xfunc_join_expense(Query *queryInfo, JoinPath path, int whichchild)
/*
* * the second argument to xfunc_card_unreferenced reflects all the *
* relations involved in the join clause, i.e. all the relids in the
* Rel * of the join clause
* RelOptInfo * of the join clause
*/
Count card = 0;
Cost cost = xfunc_expense_per_tuple(path, whichchild);
@@ -736,9 +736,9 @@ xfunc_card_unreferenced(Query *queryInfo,
/* find all relids of base relations referenced in query */
foreach(temp, queryInfo->base_relation_list_)
{
Assert(lnext(get_relids((Rel) lfirst(temp))) == LispNil);
Assert(lnext(get_relids((RelOptInfo) lfirst(temp))) == LispNil);
allrelids = lappend(allrelids,
lfirst(get_relids((Rel) lfirst(temp))));
lfirst(get_relids((RelOptInfo) lfirst(temp))));
}
/* find all relids referenced in query but not in clause */
@@ -758,7 +758,7 @@ xfunc_card_product(Query *queryInfo, Relid relids)
{
LispValue cinfonode;
LispValue temp;
Rel currel;
RelOptInfo currel;
Cost tuples;
Count retval = 0;
@@ -1095,8 +1095,8 @@ xfunc_total_path_cost(JoinPath pathnode)
Cost
xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
{
Rel outerrel = get_parent((Path) get_outerjoinpath(joinnode));
Rel innerrel = get_parent((Path) get_innerjoinpath(joinnode));
RelOptInfo outerrel = get_parent((Path) get_outerjoinpath(joinnode));
RelOptInfo innerrel = get_parent((Path) get_innerjoinpath(joinnode));
Count outerwidth = get_width(outerrel);
Count outers_per_page = ceil(BLCKSZ / (outerwidth + sizeof(HeapTupleData)));
@@ -1133,11 +1133,11 @@ xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
** nodes to point to the correct varno (either INNER or OUTER, depending
** on which child the clause was pulled from), and the right varattno in the
** target list of the child's former relation. If the target list of the
** child Rel does not contain the attribute we need, we add it.
** child RelOptInfo does not contain the attribute we need, we add it.
*/
void
xfunc_fixvars(LispValue clause, /* clause being pulled up */
Rel rel, /* rel it's being pulled from */
RelOptInfo rel, /* rel it's being pulled from */
int varno) /* whether rel is INNER or OUTER of join */
{
LispValue tmpclause; /* temporary variable */
@@ -1426,9 +1426,9 @@ do { \
** Just like _copyRel, but doesn't copy the paths
*/
bool
xfunc_copyrel(Rel from, Rel *to)
xfunc_copyrel(RelOptInfo from, RelOptInfo *to)
{
Rel newnode;
RelOptInfo newnode;
Pointer (*alloc) () = palloc;
@@ -1444,7 +1444,7 @@ xfunc_copyrel(Rel from, Rel *to)
}
/* COPY_NEW(c) */
newnode = (Rel) (*alloc) (classSize(Rel));
newnode = (RelOptInfo) (*alloc) (classSize(RelOptInfo));
if (newnode == NULL)
return false;