diff options
Diffstat (limited to 'src/backend/optimizer/path')
-rw-r--r-- | src/backend/optimizer/path/allpaths.c | 13 | ||||
-rw-r--r-- | src/backend/optimizer/path/clausesel.c | 40 | ||||
-rw-r--r-- | src/backend/optimizer/path/costsize.c | 6 | ||||
-rw-r--r-- | src/backend/optimizer/path/hashutils.c | 18 | ||||
-rw-r--r-- | src/backend/optimizer/path/indxpath.c | 132 | ||||
-rw-r--r-- | src/backend/optimizer/path/joinpath.c | 6 | ||||
-rw-r--r-- | src/backend/optimizer/path/joinrels.c | 38 | ||||
-rw-r--r-- | src/backend/optimizer/path/mergeutils.c | 18 | ||||
-rw-r--r-- | src/backend/optimizer/path/orindxpath.c | 12 | ||||
-rw-r--r-- | src/backend/optimizer/path/predmig.c | 30 | ||||
-rw-r--r-- | src/backend/optimizer/path/xfunc.c | 94 |
11 files changed, 201 insertions, 206 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 4e5ab10094d..ee8b6be27d7 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.24 1999/02/02 20:30:05 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.25 1999/02/03 20:15:28 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -122,10 +122,10 @@ find_rel_paths(Query *root, List *rels) rel_index_scan_list = find_index_paths(root, rel, find_relation_indices(root, rel), - rel->clauseinfo, + rel->restrictinfo, rel->joininfo); - or_index_scan_list = create_or_index_paths(root, rel, rel->clauseinfo); + or_index_scan_list = create_or_index_paths(root, rel, rel->restrictinfo); rel->pathlist = add_pathlist(rel, sequential_scan_list, @@ -145,7 +145,7 @@ find_rel_paths(Query *root, List *rels) * if there is a qualification of sequential scan the selec. value * is not set -- so set it explicitly -- Sunita */ - set_rest_selec(root, rel->clauseinfo); + set_rest_selec(root, rel->restrictinfo); rel->size = compute_rel_size(rel); rel->width = compute_rel_width(rel); } @@ -290,7 +290,7 @@ print_joinclauses(Query *root, List *clauses) foreach(l, clauses) { - ClauseInfo *c = lfirst(l); + RestrictInfo *c = lfirst(l); print_expr((Node *) c->clause, root->rtable); if (lnext(l)) @@ -347,8 +347,7 @@ print_path(Query *root, Path *path, int indent) for (i = 0; i < indent + 1; i++) printf("\t"); printf(" clauses=("); - print_joinclauses(root, - ((JoinPath *) path)->pathclauseinfo); + print_joinclauses(root, ((JoinPath *) path)->pathinfo); printf(")\n"); if (nodeTag(path) == T_MergePath) diff --git a/src/backend/optimizer/path/clausesel.c b/src/backend/optimizer/path/clausesel.c index 0bdca62893f..3a10b05bb36 100644 --- a/src/backend/optimizer/path/clausesel.c +++ b/src/backend/optimizer/path/clausesel.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.14 1998/11/09 02:49:13 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.15 1999/02/03 20:15:28 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ #include "nodes/primnodes.h" #include "nodes/relation.h" #include "optimizer/clauses.h" -#include "optimizer/clauseinfo.h" +#include "optimizer/restrictinfo.h" #include "optimizer/cost.h" #include "optimizer/internal.h" #include "optimizer/plancat.h" @@ -35,7 +35,7 @@ static Cost compute_selec(Query *root, List *clauses, List *or_selectivities); /* * set_clause_selectivities - - * Sets the selectivity field for each of clause in 'clauseinfo-list' + * Sets the selectivity field for each of clause in 'restrictinfo-list' * to 'new-selectivity'. If the selectivity has already been set, reset * it only if the new one is better. * @@ -43,15 +43,15 @@ static Cost compute_selec(Query *root, List *clauses, List *or_selectivities); * */ void -set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity) +set_clause_selectivities(List *restrictinfo_list, Cost new_selectivity) { List *temp; - ClauseInfo *clausenode; + RestrictInfo *clausenode; Cost cost_clause; - foreach(temp, clauseinfo_list) + foreach(temp, restrictinfo_list) { - clausenode = (ClauseInfo *) lfirst(temp); + clausenode = (RestrictInfo *) lfirst(temp); cost_clause = clausenode->selectivity; if (FLOAT_IS_ZERO(cost_clause) || new_selectivity < cost_clause) clausenode->selectivity = new_selectivity; @@ -60,23 +60,23 @@ set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity) /* * product_selec - - * Multiplies the selectivities of each clause in 'clauseinfo-list'. + * Multiplies the selectivities of each clause in 'restrictinfo-list'. * - * Returns a flonum corresponding to the selectivity of 'clauseinfo-list'. + * Returns a flonum corresponding to the selectivity of 'restrictinfo-list'. */ Cost -product_selec(List *clauseinfo_list) +product_selec(List *restrictinfo_list) { Cost result = 1.0; - if (clauseinfo_list != NIL) + if (restrictinfo_list != NIL) { List *xclausenode = NIL; Cost temp; - foreach(xclausenode, clauseinfo_list) + foreach(xclausenode, restrictinfo_list) { - temp = ((ClauseInfo *) lfirst(xclausenode))->selectivity; + temp = ((RestrictInfo *) lfirst(xclausenode))->selectivity; result = result * temp; } } @@ -89,7 +89,7 @@ product_selec(List *clauseinfo_list) * those clauses that haven't been assigned a selectivity by an index. * * Returns nothing of interest. - * MODIFIES: selectivities of the various rel's clauseinfo + * MODIFIES: selectivities of the various rel's restrictinfo * slots. */ void @@ -101,28 +101,28 @@ set_rest_relselec(Query *root, List *rel_list) foreach(x, rel_list) { rel = (RelOptInfo *) lfirst(x); - set_rest_selec(root, rel->clauseinfo); + set_rest_selec(root, rel->restrictinfo); } } /* * set_rest_selec - * Sets the selectivity fields for those clauses within a single - * relation's 'clauseinfo-list' that haven't already been set. + * relation's 'restrictinfo-list' that haven't already been set. * * Returns nothing of interest. * */ void -set_rest_selec(Query *root, List *clauseinfo_list) +set_rest_selec(Query *root, List *restrictinfo_list) { List *temp = NIL; - ClauseInfo *clausenode = (ClauseInfo *) NULL; + RestrictInfo *clausenode = (RestrictInfo *) NULL; Cost cost_clause; - foreach(temp, clauseinfo_list) + foreach(temp, restrictinfo_list) { - clausenode = (ClauseInfo *) lfirst(temp); + clausenode = (RestrictInfo *) lfirst(temp); cost_clause = clausenode->selectivity; /* diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c index 5fbf3e5059f..fd4ef5c9b2b 100644 --- a/src/backend/optimizer/path/costsize.c +++ b/src/backend/optimizer/path/costsize.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.25 1998/09/01 04:29:30 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.26 1999/02/03 20:15:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -365,7 +365,7 @@ compute_rel_size(RelOptInfo * rel) Cost temp; int temp1; - temp = rel->tuples * product_selec(rel->clauseinfo); + temp = rel->tuples * product_selec(rel->restrictinfo); Assert(temp >= 0); if (temp >= (MAXINT - 1)) temp1 = MAXINT; @@ -443,7 +443,7 @@ compute_joinrel_size(JoinPath *joinpath) temp *= ((Path *) joinpath->outerjoinpath)->parent->size; temp *= ((Path *) joinpath->innerjoinpath)->parent->size; - temp = temp * product_selec(joinpath->pathclauseinfo); + temp = temp * product_selec(joinpath->pathinfo); if (temp >= (MAXINT - 1)) temp1 = MAXINT; else diff --git a/src/backend/optimizer/path/hashutils.c b/src/backend/optimizer/path/hashutils.c index 59bf4897c0a..e55496809d3 100644 --- a/src/backend/optimizer/path/hashutils.c +++ b/src/backend/optimizer/path/hashutils.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.7 1998/09/01 04:29:32 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.8 1999/02/03 20:15:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -24,29 +24,29 @@ static HInfo *match_hashop_hashinfo(Oid hashop, List *hashinfo_list); /* * group-clauses-by-hashop-- - * If a join clause node in 'clauseinfo-list' is hashjoinable, store + * If a join clause node in 'restrictinfo-list' is hashjoinable, store * it within a hashinfo node containing other clause nodes with the same * hash operator. * - * 'clauseinfo-list' is the list of clauseinfo nodes + * 'restrictinfo-list' is the list of restrictinfo nodes * 'inner-relid' is the relid of the inner join relation * * Returns the new list of hashinfo nodes. * */ List * -group_clauses_by_hashop(List *clauseinfo_list, +group_clauses_by_hashop(List *restrictinfo_list, int inner_relid) { List *hashinfo_list = NIL; - ClauseInfo *clauseinfo = (ClauseInfo *) NULL; + RestrictInfo *restrictinfo = (RestrictInfo *) NULL; List *i = NIL; Oid hashjoinop = 0; - foreach(i, clauseinfo_list) + foreach(i, restrictinfo_list) { - clauseinfo = (ClauseInfo *) lfirst(i); - hashjoinop = clauseinfo->hashjoinoperator; + restrictinfo = (RestrictInfo *) lfirst(i); + hashjoinop = restrictinfo->hashjoinoperator; /* * Create a new hashinfo node and add it to 'hashinfo-list' if one @@ -55,7 +55,7 @@ group_clauses_by_hashop(List *clauseinfo_list, if (hashjoinop) { HInfo *xhashinfo = (HInfo *) NULL; - Expr *clause = clauseinfo->clause; + Expr *clause = restrictinfo->clause; Var *leftop = get_leftop(clause); Var *rightop = get_rightop(clause); JoinKey *keys = (JoinKey *) NULL; diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index 3d505c87c00..d46876ec0c9 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.35 1998/09/21 15:41:26 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.36 1999/02/03 20:15:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -29,7 +29,7 @@ #include "nodes/pg_list.h" #include "nodes/relation.h" #include "optimizer/clauses.h" -#include "optimizer/clauseinfo.h" +#include "optimizer/restrictinfo.h" #include "optimizer/cost.h" #include "optimizer/internal.h" #include "optimizer/keys.h" @@ -46,25 +46,25 @@ static void match_index_orclauses(RelOptInfo * rel, RelOptInfo * index, int indexkey, - int xclass, List *clauseinfo_list); + int xclass, List *restrictinfo_list); static bool match_index_to_operand(int indexkey, Expr *operand, RelOptInfo * rel, RelOptInfo * index); static List *match_index_orclause(RelOptInfo * rel, RelOptInfo * index, int indexkey, int xclass, List *or_clauses, List *other_matching_indices); static List *group_clauses_by_indexkey(RelOptInfo * rel, RelOptInfo * index, - int *indexkeys, Oid *classes, List *clauseinfo_list); + int *indexkeys, Oid *classes, List *restrictinfo_list); static List *group_clauses_by_ikey_for_joins(RelOptInfo * rel, RelOptInfo * index, int *indexkeys, Oid *classes, List *join_cinfo_list, List *restr_cinfo_list); -static ClauseInfo *match_clause_to_indexkey(RelOptInfo * rel, RelOptInfo * index, int indexkey, - int xclass, ClauseInfo * clauseInfo, bool join); -static bool pred_test(List *predicate_list, List *clauseinfo_list, +static RestrictInfo *match_clause_to_indexkey(RelOptInfo * rel, RelOptInfo * index, int indexkey, + int xclass, RestrictInfo * clauseInfo, bool join); +static bool pred_test(List *predicate_list, List *restrictinfo_list, List *joininfo_list); -static bool one_pred_test(Expr *predicate, List *clauseinfo_list); +static bool one_pred_test(Expr *predicate, List *restrictinfo_list); 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(RelOptInfo * rel, RelOptInfo * index, - List *joininfo_list, List *clauseinfo_list); + List *joininfo_list, List *restrictinfo_list); static List *index_innerjoin(Query *root, RelOptInfo * rel, List *clausegroup_list, RelOptInfo * index); static List *create_index_paths(Query *root, RelOptInfo * rel, RelOptInfo * index, @@ -90,7 +90,7 @@ static bool function_index_operand(Expr *funcOpnd, RelOptInfo * rel, RelOptInfo * * 'rel' is the relation entry to which these index paths correspond * 'indices' is a list of possible index paths - * 'clauseinfo-list' is a list of restriction clauseinfo nodes for 'rel' + * 'restrictinfo-list' is a list of restriction restrictinfo nodes for 'rel' * 'joininfo-list' is a list of joininfo nodes for 'rel' * 'sortkeys' is a node describing the result sort order (from * (find_sortkeys)) @@ -102,7 +102,7 @@ List * find_index_paths(Query *root, RelOptInfo * rel, List *indices, - List *clauseinfo_list, + List *restrictinfo_list, List *joininfo_list) { List *scanclausegroups = NIL; @@ -122,12 +122,12 @@ find_index_paths(Query *root, * test */ if (index->indpred != NIL) - if (!pred_test(index->indpred, clauseinfo_list, joininfo_list)) + if (!pred_test(index->indpred, restrictinfo_list, joininfo_list)) continue; /* * 1. Try matching the index against subclauses of an 'or' clause. - * The fields of the clauseinfo nodes are marked with lists of the + * The fields of the restrictinfo nodes are marked with lists of the * matching indices. No path are actually created. We currently * only look to match the first key. We don't find multi-key * index cases where an AND matches the first key, and the OR @@ -137,7 +137,7 @@ find_index_paths(Query *root, index, index->indexkeys[0], index->classlist[0], - clauseinfo_list); + restrictinfo_list); /* * 2. If the keys of this index match any of the available @@ -148,7 +148,7 @@ find_index_paths(Query *root, index, index->indexkeys, index->classlist, - clauseinfo_list); + restrictinfo_list); scanpaths = NIL; if (scanclausegroups != NIL) @@ -165,7 +165,7 @@ find_index_paths(Query *root, * mergejoin, or if the index can possibly be used for scanning * the inner relation of a nestloop join. */ - joinclausegroups = indexable_joinclauses(rel, index, joininfo_list, clauseinfo_list); + joinclausegroups = indexable_joinclauses(rel, index, joininfo_list, restrictinfo_list); joinpaths = NIL; if (joinclausegroups != NIL) @@ -206,13 +206,13 @@ find_index_paths(Query *root, * about the index. * * Essentially, this adds 'index' to the list of indices in the - * ClauseInfo field of each of the clauses which it matches. + * RestrictInfo field of each of the clauses which it matches. * * 'rel' is the node of the relation on which the index is defined. * 'index' is the index node. * 'indexkey' is the (single) key of the index * 'class' is the class of the operator corresponding to 'indexkey'. - * 'clauseinfo-list' is the list of available restriction clauses. + * 'restrictinfo-list' is the list of available restriction clauses. * * Returns nothing. * @@ -222,15 +222,15 @@ match_index_orclauses(RelOptInfo * rel, RelOptInfo * index, int indexkey, int xclass, - List *clauseinfo_list) + List *restrictinfo_list) { - ClauseInfo *clauseinfo = (ClauseInfo *) NULL; + RestrictInfo *restrictinfo = (RestrictInfo *) NULL; List *i = NIL; - foreach(i, clauseinfo_list) + foreach(i, restrictinfo_list) { - clauseinfo = (ClauseInfo *) lfirst(i); - if (valid_or_clause(clauseinfo)) + restrictinfo = (RestrictInfo *) lfirst(i); + if (valid_or_clause(restrictinfo)) { /* @@ -238,11 +238,11 @@ match_index_orclauses(RelOptInfo * rel, * each of its subclauses. The list is generated by adding * 'index' to the existing list where appropriate. */ - clauseinfo->indexids = + restrictinfo->indexids = match_index_orclause(rel, index, indexkey, xclass, - clauseinfo->clause->args, - clauseinfo->indexids); + restrictinfo->clause->args, + restrictinfo->indexids); } } } @@ -392,15 +392,15 @@ group_clauses_by_indexkey(RelOptInfo * rel, RelOptInfo * index, int *indexkeys, Oid *classes, - List *clauseinfo_list) + List *restrictinfo_list) { List *curCinfo = NIL; - ClauseInfo *matched_clause = (ClauseInfo *) NULL; + RestrictInfo *matched_clause = (RestrictInfo *) NULL; List *clausegroup = NIL; int curIndxKey; Oid curClass; - if (clauseinfo_list == NIL || indexkeys[0] == 0) + if (restrictinfo_list == NIL || indexkeys[0] == 0) return NIL; do @@ -410,9 +410,9 @@ group_clauses_by_indexkey(RelOptInfo * rel, curIndxKey = indexkeys[0]; curClass = classes[0]; - foreach(curCinfo, clauseinfo_list) + foreach(curCinfo, restrictinfo_list) { - ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo); + RestrictInfo *temp = (RestrictInfo *) lfirst(curCinfo); matched_clause = match_clause_to_indexkey(rel, index, @@ -458,7 +458,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo * rel, List *restr_cinfo_list) { List *curCinfo = NIL; - ClauseInfo *matched_clause = (ClauseInfo *) NULL; + RestrictInfo *matched_clause = (RestrictInfo *) NULL; List *clausegroup = NIL; int curIndxKey; Oid curClass; @@ -476,7 +476,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo * rel, foreach(curCinfo, join_cinfo_list) { - ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo); + RestrictInfo *temp = (RestrictInfo *) lfirst(curCinfo); matched_clause = match_clause_to_indexkey(rel, index, @@ -492,7 +492,7 @@ group_clauses_by_ikey_for_joins(RelOptInfo * rel, } foreach(curCinfo, restr_cinfo_list) { - ClauseInfo *temp = (ClauseInfo *) lfirst(curCinfo); + RestrictInfo *temp = (RestrictInfo *) lfirst(curCinfo); matched_clause = match_clause_to_indexkey(rel, index, @@ -565,18 +565,18 @@ group_clauses_by_ikey_for_joins(RelOptInfo * rel, * * If the clause being matched is a join clause, then 'join' is t. * - * Returns a single clauseinfo node corresponding to the matching + * Returns a single restrictinfo node corresponding to the matching * clause. * * NOTE: returns nil if clause is an or_clause. * */ -static ClauseInfo * +static RestrictInfo * match_clause_to_indexkey(RelOptInfo * rel, RelOptInfo * index, int indexkey, int xclass, - ClauseInfo * clauseInfo, + RestrictInfo * clauseInfo, bool join) { Expr *clause = clauseInfo->clause; @@ -588,7 +588,7 @@ match_clause_to_indexkey(RelOptInfo * rel, if (or_clause((Node *) clause) || not_clause((Node *) clause) || single_node((Node *) clause)) - return (ClauseInfo *) NULL; + return (RestrictInfo *) NULL; leftop = get_leftop(clause); rightop = get_rightop(clause); @@ -778,7 +778,7 @@ match_clause_to_indexkey(RelOptInfo * rel, * pred_test-- * Does the "predicate inclusion test" for partial indexes. * - * Recursively checks whether the clauses in clauseinfo_list imply + * Recursively checks whether the clauses in restrictinfo_list imply * that the given predicate is true. * * This routine (together with the routines it calls) iterates over @@ -789,7 +789,7 @@ match_clause_to_indexkey(RelOptInfo * rel, * successfully cnfify()-ed). --Nels, Jan '93 */ static bool -pred_test(List *predicate_list, List *clauseinfo_list, List *joininfo_list) +pred_test(List *predicate_list, List *restrictinfo_list, List *joininfo_list) { List *pred, *items, @@ -802,12 +802,12 @@ pred_test(List *predicate_list, List *clauseinfo_list, List *joininfo_list) * an index on c.d), then we could use that equivalence class info * here with joininfo_list to do more complete tests for the usability * of a partial index. For now, the test only uses restriction - * clauses (those in clauseinfo_list). --Nels, Dec '92 + * clauses (those in restrictinfo_list). --Nels, Dec '92 */ if (predicate_list == NULL) return true; /* no predicate: the index is usable */ - if (clauseinfo_list == NULL) + if (restrictinfo_list == NULL) return false; /* no restriction clauses: the test must * fail */ @@ -823,11 +823,11 @@ pred_test(List *predicate_list, List *clauseinfo_list, List *joininfo_list) items = ((Expr *) lfirst(pred))->args; foreach(item, items) { - if (!one_pred_test(lfirst(item), clauseinfo_list)) + if (!one_pred_test(lfirst(item), restrictinfo_list)) return false; } } - else if (!one_pred_test(lfirst(pred), clauseinfo_list)) + else if (!one_pred_test(lfirst(pred), restrictinfo_list)) return false; } return true; @@ -840,17 +840,17 @@ pred_test(List *predicate_list, List *clauseinfo_list, List *joininfo_list) * expression. */ static bool -one_pred_test(Expr *predicate, List *clauseinfo_list) +one_pred_test(Expr *predicate, List *restrictinfo_list) { - ClauseInfo *clauseinfo; + RestrictInfo *restrictinfo; List *item; Assert(predicate != NULL); - foreach(item, clauseinfo_list) + foreach(item, restrictinfo_list) { - clauseinfo = (ClauseInfo *) lfirst(item); + restrictinfo = (RestrictInfo *) lfirst(item); /* if any clause implies the predicate, return true */ - if (one_pred_clause_expr_test(predicate, (Node *) clauseinfo->clause)) + if (one_pred_clause_expr_test(predicate, (Node *) restrictinfo->clause)) return true; } return false; @@ -1181,14 +1181,14 @@ clause_pred_clause_test(Expr *predicate, Node *clause) * * Returns a list of these clause groups. * - * Added: clauseinfo_list - list of restriction ClauseInfos. It's to + * Added: restrictinfo_list - list of restriction RestrictInfos. It's to * support multi-column indices in joins and for cases * when a key is in both join & restriction clauses. - vadim 03/18/97 * */ static List * indexable_joinclauses(RelOptInfo * rel, RelOptInfo * index, - List *joininfo_list, List *clauseinfo_list) + List *joininfo_list, List *restrictinfo_list) { JoinInfo *joininfo = (JoinInfo *) NULL; List *cg_list = NIL; @@ -1199,21 +1199,21 @@ indexable_joinclauses(RelOptInfo * rel, RelOptInfo * index, { joininfo = (JoinInfo *) lfirst(i); - if (joininfo->jinfoclauseinfo == NIL) + if (joininfo->jinfo_restrictinfo == NIL) continue; clausegroups = group_clauses_by_ikey_for_joins(rel, index, index->indexkeys, index->classlist, - joininfo->jinfoclauseinfo, - clauseinfo_list); + joininfo->jinfo_restrictinfo, + restrictinfo_list); if (clausegroups != NIL) { List *clauses = lfirst(clausegroups); - ((ClauseInfo *) lfirst(clauses))->cinfojoinid = + ((RestrictInfo *) lfirst(clauses))->cinfojoinid = joininfo->otherrels; } cg_list = nconc(cg_list, clausegroups); @@ -1239,7 +1239,7 @@ extract_restrict_clauses(List *clausegroup) foreach(l, clausegroup) { - ClauseInfo *cinfo = lfirst(l); + RestrictInfo *cinfo = lfirst(l); if (!is_joinable((Node *) cinfo->clause)) restrict_cls = lappend(restrict_cls, cinfo); @@ -1254,7 +1254,7 @@ extract_restrict_clauses(List *clausegroup) * Creates index path nodes corresponding to paths to be used as inner * relations in nestloop joins. * - * 'clausegroup-list' is a list of list of clauseinfo nodes which can use + * 'clausegroup-list' is a list of list of restrictinfo nodes which can use * 'index' on their inner relation. * * Returns a list of index pathnodes. @@ -1304,7 +1304,7 @@ index_innerjoin(Query *root, RelOptInfo * rel, List *clausegroup_list, pathnode->indexkeys = index->indexkeys; pathnode->indexqual = clausegroup; - pathnode->path.joinid = ((ClauseInfo *) lfirst(clausegroup))->cinfojoinid; + pathnode->path.joinid = ((RestrictInfo *) lfirst(clausegroup))->cinfojoinid; pathnode->path.path_cost = cost_index((Oid) lfirsti(index->relids), @@ -1317,11 +1317,11 @@ index_innerjoin(Query *root, RelOptInfo * rel, List *clausegroup_list, true); /* - * copy clauseinfo list into path for expensive function + * copy restrictinfo list into path for expensive function * processing -- JMH, 7/7/92 */ - pathnode->path.locclauseinfo = - set_difference(copyObject((Node *) rel->clauseinfo), + pathnode->path.loc_restrictinfo = + set_difference(copyObject((Node *) rel->restrictinfo), clausegroup); #if 0 /* fix xfunc */ @@ -1343,7 +1343,7 @@ index_innerjoin(Query *root, RelOptInfo * rel, List *clausegroup_list, * (restriction or join) that can be used in conjunction with an index. * * 'rel' is the relation for which 'index' is defined - * 'clausegroup-list' is the list of clause groups (lists of clauseinfo + * 'clausegroup-list' is the list of clause groups (lists of restrictinfo * nodes) grouped by mergejoinorder * 'join' is a flag indicating whether or not the clauses are join * clauses @@ -1366,7 +1366,7 @@ create_index_paths(Query *root, foreach(i, clausegroup_list) { - ClauseInfo *clauseinfo; + RestrictInfo *restrictinfo; List *temp_node = NIL; bool temp = true; @@ -1374,10 +1374,10 @@ create_index_paths(Query *root, foreach(j, clausegroup) { - clauseinfo = (ClauseInfo *) lfirst(j); - if (!(is_joinable((Node *) clauseinfo->clause) && + restrictinfo = (RestrictInfo *) lfirst(j); + if (!(is_joinable((Node *) restrictinfo->clause) && equal_path_merge_ordering(index->ordering, - clauseinfo->mergejoinorder))) + restrictinfo->mergejoinorder))) temp = false; } diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c index f8291f7e964..3199abedf9b 100644 --- a/src/backend/optimizer/path/joinpath.c +++ b/src/backend/optimizer/path/joinpath.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.10 1998/09/01 04:29:35 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.11 1999/02/03 20:15:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -97,14 +97,14 @@ find_all_join_paths(Query *root, List *joinrels) if (_enable_mergejoin_) { mergeinfo_list = - group_clauses_by_order(joinrel->clauseinfo, + group_clauses_by_order(joinrel->restrictinfo, lfirsti(innerrel->relids)); } if (_enable_hashjoin_) { hashinfo_list = - group_clauses_by_hashop(joinrel->clauseinfo, + group_clauses_by_hashop(joinrel->restrictinfo, lfirsti(innerrel->relids)); } diff --git a/src/backend/optimizer/path/joinrels.c b/src/backend/optimizer/path/joinrels.c index 636207c9410..34eec9fe5a9 100644 --- a/src/backend/optimizer/path/joinrels.c +++ b/src/backend/optimizer/path/joinrels.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.15 1998/09/01 04:29:37 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.16 1999/02/03 20:15:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -224,7 +224,7 @@ init_join_rel(RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * joininf joinrel->classlist = NULL; joinrel->relam = InvalidOid; joinrel->ordering = NULL; - joinrel->clauseinfo = NIL; + joinrel->restrictinfo = NIL; joinrel->joininfo = NULL; joinrel->innerjoin = NIL; joinrel->superrels = NIL; @@ -238,7 +238,7 @@ init_join_rel(RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * joininf if (joininfo) { - joinrel->clauseinfo = joininfo->jinfoclauseinfo; + joinrel->restrictinfo = joininfo->jinfo_restrictinfo; if (BushyPlanFlag) joininfo->inactive = true; } @@ -346,22 +346,18 @@ new_joininfo_list(List *joininfo_list, List *join_relids) current_joininfo_list); if (other_joininfo) { - other_joininfo->jinfoclauseinfo = - (List *) LispUnion(joininfo->jinfoclauseinfo, - other_joininfo->jinfoclauseinfo); + other_joininfo->jinfo_restrictinfo = + (List *) LispUnion(joininfo->jinfo_restrictinfo, + other_joininfo->jinfo_restrictinfo); } else { other_joininfo = makeNode(JoinInfo); - other_joininfo->otherrels = - joininfo->otherrels; - other_joininfo->jinfoclauseinfo = - joininfo->jinfoclauseinfo; - other_joininfo->mergejoinable = - joininfo->mergejoinable; - other_joininfo->hashjoinable = - joininfo->hashjoinable; + other_joininfo->otherrels = joininfo->otherrels; + other_joininfo->jinfo_restrictinfo = joininfo->jinfo_restrictinfo; + other_joininfo->mergejoinable = joininfo->mergejoinable; + other_joininfo->hashjoinable = joininfo->hashjoinable; other_joininfo->inactive = false; current_joininfo_list = lcons(other_joininfo, @@ -412,7 +408,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels) { JoinInfo *joininfo = (JoinInfo *) lfirst(xjoininfo); List *other_rels = joininfo->otherrels; - List *clause_info = joininfo->jinfoclauseinfo; + List *restrict_info = joininfo->jinfo_restrictinfo; bool mergejoinable = joininfo->mergejoinable; bool hashjoinable = joininfo->hashjoinable; @@ -425,7 +421,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels) JoinInfo *new_joininfo = makeNode(JoinInfo); new_joininfo->otherrels = joinrel->relids; - new_joininfo->jinfoclauseinfo = clause_info; + new_joininfo->jinfo_restrictinfo = restrict_info; new_joininfo->mergejoinable = mergejoinable; new_joininfo->hashjoinable = hashjoinable; new_joininfo->inactive = false; @@ -445,16 +441,16 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels) if (other_joininfo) { - other_joininfo->jinfoclauseinfo = - (List *) LispUnion(clause_info, - other_joininfo->jinfoclauseinfo); + other_joininfo->jinfo_restrictinfo = + (List *) LispUnion(restrict_info, + other_joininfo->jinfo_restrictinfo); } else { JoinInfo *new_joininfo = makeNode(JoinInfo); new_joininfo->otherrels = new_relids; - new_joininfo->jinfoclauseinfo = clause_info; + new_joininfo->jinfo_restrictinfo = restrict_info; new_joininfo->mergejoinable = mergejoinable; new_joininfo->hashjoinable = hashjoinable; new_joininfo->inactive = false; @@ -583,7 +579,7 @@ set_joinrel_size(RelOptInfo * joinrel, RelOptInfo * outer_rel, RelOptInfo * inne } else { - selec = product_selec(jinfo->jinfoclauseinfo); + selec = product_selec(jinfo->jinfo_restrictinfo); /* ntuples = Min(outer_rel->tuples,inner_rel->tuples) * selec; */ ntuples = outer_rel->tuples * inner_rel->tuples * selec; } diff --git a/src/backend/optimizer/path/mergeutils.c b/src/backend/optimizer/path/mergeutils.c index 2d1d0215112..5e465f1e39c 100644 --- a/src/backend/optimizer/path/mergeutils.c +++ b/src/backend/optimizer/path/mergeutils.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.9 1998/09/01 04:29:40 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.10 1999/02/03 20:15:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -23,27 +23,27 @@ /* * group-clauses-by-order-- - * If a join clause node in 'clauseinfo-list' is mergejoinable, store + * If a join clause node in 'restrictinfo-list' is mergejoinable, store * it within a mergeinfo node containing other clause nodes with the same * mergejoin ordering. * - * 'clauseinfo-list' is the list of clauseinfo nodes + * 'restrictinfo-list' is the list of restrictinfo nodes * 'inner-relid' is the relid of the inner join relation * * Returns the new list of mergeinfo nodes. * */ List * -group_clauses_by_order(List *clauseinfo_list, +group_clauses_by_order(List *restrictinfo_list, int inner_relid) { List *mergeinfo_list = NIL; - List *xclauseinfo = NIL; + List *xrestrictinfo = NIL; - foreach(xclauseinfo, clauseinfo_list) + foreach(xrestrictinfo, restrictinfo_list) { - ClauseInfo *clauseinfo = (ClauseInfo *) lfirst(xclauseinfo); - MergeOrder *merge_ordering = clauseinfo->mergejoinorder; + RestrictInfo *restrictinfo = (RestrictInfo *) lfirst(xrestrictinfo); + MergeOrder *merge_ordering = restrictinfo->mergejoinorder; if (merge_ordering) { @@ -54,7 +54,7 @@ group_clauses_by_order(List *clauseinfo_list, */ PathOrder p_ordering; MInfo *xmergeinfo; - Expr *clause = clauseinfo->clause; + Expr *clause = restrictinfo->clause; Var *leftop = get_leftop(clause); Var *rightop = get_rightop(clause); JoinKey *keys; diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c index 31bd977de16..6537ac1338a 100644 --- a/src/backend/optimizer/path/orindxpath.c +++ b/src/backend/optimizer/path/orindxpath.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.12 1998/09/21 15:41:27 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.13 1999/02/03 20:15:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,7 @@ #include "optimizer/internal.h" #include "optimizer/clauses.h" -#include "optimizer/clauseinfo.h" +#include "optimizer/restrictinfo.h" #include "optimizer/paths.h" #include "optimizer/cost.h" #include "optimizer/plancat.h" @@ -58,7 +58,7 @@ create_or_index_paths(Query *root, foreach(clist, clauses) { - ClauseInfo *clausenode = (ClauseInfo *) (lfirst(clist)); + RestrictInfo *clausenode = (RestrictInfo *) (lfirst(clist)); /* * Check to see if this clause is an 'or' clause, and, if so, @@ -118,11 +118,11 @@ create_or_index_paths(Query *root, pathnode->path.path_cost = cost; /* - * copy clauseinfo list into path for expensive function + * copy restrictinfo list into path for expensive function * processing -- JMH, 7/7/92 */ - pathnode->path.locclauseinfo = - set_difference(copyObject((Node *) rel->clauseinfo), + pathnode->path.loc_restrictinfo = + set_difference(copyObject((Node *) rel->restrictinfo), lcons(clausenode, NIL)); #if 0 /* fix xfunc */ diff --git a/src/backend/optimizer/path/predmig.c b/src/backend/optimizer/path/predmig.c index b1ff33cee63..fcd77f85d74 100644 --- a/src/backend/optimizer/path/predmig.c +++ b/src/backend/optimizer/path/predmig.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.13 1998/09/01 04:29:42 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.14 1999/02/03 20:15:34 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -64,7 +64,7 @@ static void xfunc_form_groups(Stream root, Stream bottom); static void xfunc_free_stream(Stream root); static Stream xfunc_add_clauses(Stream current); static void xfunc_setup_group(Stream node, Stream bottom); -static Stream xfunc_streaminsert(ClauseInfo clauseinfo, Stream current, +static Stream xfunc_streaminsert(RestrictInfo restrictinfo, Stream current, int clausetype); static int xfunc_num_relids(Stream node); static StreamPtr xfunc_get_downjoin(Stream node); @@ -142,7 +142,7 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */ set_downstream(laststream, (StreamPtr) newstream); set_downstream(newstream, (StreamPtr) NULL); set_pathptr(newstream, (pathPtr) pathnode); - set_cinfo(newstream, (ClauseInfo) NULL); + set_cinfo(newstream, (RestrictInfo) NULL); set_clausetype(newstream, XFUNC_UNKNOWN); /* base case: we're at a leaf, call xfunc_series_llel */ @@ -315,7 +315,7 @@ xfunc_complete_stream(Stream stream) static bool xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath) { - ClauseInfo clauseinfo = get_cinfo(pullme); + RestrictInfo restrictinfo = get_cinfo(pullme); bool progress = false; Stream upjoin, orignode, @@ -325,7 +325,7 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath) /* find node in origstream that contains clause */ for (orignode = origstream; orignode != (Stream) NULL - && get_cinfo(orignode) != clauseinfo; + && get_cinfo(orignode) != restrictinfo; orignode = (Stream) get_downstream(orignode)) /* empty body in for loop */ ; if (!orignode) @@ -348,13 +348,13 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath) whichchild = OUTER; else whichchild = INNER; - clauseinfo = xfunc_pullup((Path) get_pathptr((Stream) get_downstream(upjoin)), + restrictinfo = xfunc_pullup((Path) get_pathptr((Stream) get_downstream(upjoin)), (JoinPath) get_pathptr(upjoin), - clauseinfo, + restrictinfo, whichchild, get_clausetype(orignode)); set_pathptr(pullme, get_pathptr(upjoin)); - /* pullme has been moved into locclauseinfo */ + /* pullme has been moved into locrestrictinfo */ set_clausetype(pullme, XFUNC_LOCPRD); /* @@ -524,10 +524,10 @@ xfunc_add_clauses(Stream current) LispValue primjoin; /* first add in the local clauses */ - foreach(temp, get_locclauseinfo((Path) get_pathptr(current))) + foreach(temp, get_loc_restrictinfo((Path) get_pathptr(current))) { topnode = - xfunc_streaminsert((ClauseInfo) lfirst(temp), topnode, + xfunc_streaminsert((RestrictInfo) lfirst(temp), topnode, XFUNC_LOCPRD); } @@ -535,11 +535,11 @@ xfunc_add_clauses(Stream current) if (IsA(get_pathptr(current), JoinPath)) { primjoin = xfunc_primary_join((JoinPath) get_pathptr(current)); - foreach(temp, get_pathclauseinfo((JoinPath) get_pathptr(current))) + foreach(temp, get_pathrestrictinfo((JoinPath) get_pathptr(current))) { - if (!equal(get_clause((ClauseInfo) lfirst(temp)), primjoin)) + if (!equal(get_clause((RestrictInfo) lfirst(temp)), primjoin)) topnode = - xfunc_streaminsert((ClauseInfo) lfirst(temp), topnode, + xfunc_streaminsert((RestrictInfo) lfirst(temp), topnode, XFUNC_JOINPRD); } } @@ -593,7 +593,7 @@ xfunc_setup_group(Stream node, Stream bottom) ** Return new node. */ static Stream -xfunc_streaminsert(ClauseInfo clauseinfo, +xfunc_streaminsert(RestrictInfo restrictinfo, Stream current, int clausetype) /* XFUNC_LOCPRD or XFUNC_JOINPRD */ { @@ -605,7 +605,7 @@ xfunc_streaminsert(ClauseInfo clauseinfo, set_upstream(current, (StreamPtr) newstream); set_downstream(newstream, (StreamPtr) current); set_pathptr(newstream, get_pathptr(current)); - set_cinfo(newstream, clauseinfo); + set_cinfo(newstream, restrictinfo); set_clausetype(newstream, clausetype); return newstream; } diff --git a/src/backend/optimizer/path/xfunc.c b/src/backend/optimizer/path/xfunc.c index f32b77cdc2a..d9d22f37f97 100644 --- a/src/backend/optimizer/path/xfunc.c +++ b/src/backend/optimizer/path/xfunc.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.22 1998/09/01 04:29:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.23 1999/02/03 20:15:34 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -59,7 +59,7 @@ void xfunc_trypullup(RelOptInfo rel) { LispValue y; /* list ptr */ - ClauseInfo maxcinfo; /* The ClauseInfo to pull up, as + RestrictInfo maxcinfo; /* The RestrictInfo to pull up, as * calculated by xfunc_shouldpull() */ JoinPath curpath; /* current path in list */ int progress; /* has progress been made this time @@ -132,7 +132,7 @@ xfunc_trypullup(RelOptInfo rel) ** xfunc_shouldpull -- ** find clause with highest rank, and decide whether to pull it up ** from child to parent. Currently we only pullup secondary join clauses - ** that are in the pathclauseinfo. Secondary hash and sort clauses are + ** that are in the pathrestrictinfo. Secondary hash and sort clauses are ** left where they are. ** If we find an expensive function but decide *not* to pull it up, ** we'd better set the unpruneable flag. -- JMH, 11/11/92 @@ -146,12 +146,12 @@ xfunc_shouldpull(Query *queryInfo, Path childpath, JoinPath parentpath, int whichchild, - ClauseInfo * maxcinfopt) /* Out: pointer to clause + RestrictInfo * maxcinfopt) /* Out: pointer to clause * to pullup */ { LispValue clauselist, tmplist; /* lists of clauses */ - ClauseInfo maxcinfo; /* clause to pullup */ + RestrictInfo maxcinfo; /* clause to pullup */ LispValue primjoinclause /* primary join clause */ = xfunc_primary_join(parentpath); Cost tmprank, @@ -160,22 +160,22 @@ xfunc_shouldpull(Query *queryInfo, Cost joincost = 0; /* join cost + primjoinclause cost */ int retval = XFUNC_LOCPRD; - clauselist = get_locclauseinfo(childpath); + clauselist = get_loc_restrictinfo(childpath); if (clauselist != LispNil) { /* find local predicate with maximum rank */ for (tmplist = clauselist, - maxcinfo = (ClauseInfo) lfirst(tmplist), + maxcinfo = (RestrictInfo) lfirst(tmplist), maxrank = xfunc_rank(get_clause(maxcinfo)); tmplist != LispNil; tmplist = lnext(tmplist)) { - if ((tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist)))) + if ((tmprank = xfunc_rank(get_clause((RestrictInfo) lfirst(tmplist)))) > maxrank) { - maxcinfo = (ClauseInfo) lfirst(tmplist); + maxcinfo = (RestrictInfo) lfirst(tmplist); maxrank = tmprank; } } @@ -187,16 +187,16 @@ xfunc_shouldpull(Query *queryInfo, * local predicate */ if (is_join(childpath) && xfunc_num_join_clauses((JoinPath) childpath) > 1) - for (tmplist = get_pathclauseinfo((JoinPath) childpath); + for (tmplist = get_pathrestrictinfo((JoinPath) childpath); tmplist != LispNil; tmplist = lnext(tmplist)) { if (tmplist != LispNil && - (tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist)))) + (tmprank = xfunc_rank(get_clause((RestrictInfo) lfirst(tmplist)))) > maxrank) { - maxcinfo = (ClauseInfo) lfirst(tmplist); + maxcinfo = (RestrictInfo) lfirst(tmplist); maxrank = tmprank; retval = XFUNC_JOINPRD; } @@ -260,13 +260,13 @@ xfunc_shouldpull(Query *queryInfo, ** 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. ** - ** Now returns a pointer to the new pulled-up ClauseInfo. -- JMH, 11/18/92 + ** Now returns a pointer to the new pulled-up RestrictInfo. -- JMH, 11/18/92 */ -ClauseInfo +RestrictInfo xfunc_pullup(Query *queryInfo, Path childpath, JoinPath parentpath, - ClauseInfo cinfo, /* clause to pull up */ + RestrictInfo cinfo, /* clause to pull up */ int whichchild, /* whether child is INNER or OUTER of join */ int clausetype) /* whether clause to pull is join or local */ { @@ -274,22 +274,22 @@ xfunc_pullup(Query *queryInfo, RelOptInfo newrel; Cost pulled_selec; Cost cost; - ClauseInfo newinfo; + RestrictInfo newinfo; /* remove clause from childpath */ newkid = (Path) copyObject((Node) childpath); if (clausetype == XFUNC_LOCPRD) { - set_locclauseinfo(newkid, + set_locrestrictinfo(newkid, xfunc_LispRemove((LispValue) cinfo, - (List) get_locclauseinfo(newkid))); + (List) get_loc_restrictinfo(newkid))); } else { - set_pathclauseinfo + set_pathrestrictinfo ((JoinPath) newkid, xfunc_LispRemove((LispValue) cinfo, - (List) get_pathclauseinfo((JoinPath) newkid))); + (List) get_pathrestrictinfo((JoinPath) newkid))); } /* @@ -320,7 +320,7 @@ xfunc_pullup(Query *queryInfo, * * We copy the cinfo, since it may appear in other plans, and we're * going * to munge it. -- JMH, 7/22/92 */ - newinfo = (ClauseInfo) copyObject((Node) cinfo); + newinfo = (RestrictInfo) copyObject((Node) cinfo); /* * * Fix all vars in the clause * to point to the right varno and @@ -329,9 +329,9 @@ xfunc_pullup(Query *queryInfo, xfunc_fixvars(get_clause(newinfo), newrel, whichchild); /* add clause to parentpath, and fix up its cost. */ - set_locclauseinfo(parentpath, + set_locrestrictinfo(parentpath, lispCons((LispValue) newinfo, - (LispValue) get_locclauseinfo(parentpath))); + (LispValue) get_loc_restrictinfo(parentpath))); /* put new childpath into the path tree */ if (whichchild == INNER) set_innerjoinpath(parentpath, (pathPtr) newkid); @@ -771,12 +771,12 @@ xfunc_card_product(Query *queryInfo, Relid relids) if (tuples) { /* not of cardinality 0 */ /* factor in the selectivity of all zero-cost clauses */ - foreach(cinfonode, get_clauseinfo(currel)) + foreach(cinfonode, get_restrictinfo(currel)) { - if (!xfunc_expense(queryInfo, get_clause((ClauseInfo) lfirst(cinfonode)))) + if (!xfunc_expense(queryInfo, get_clause((RestrictInfo) lfirst(cinfonode)))) tuples *= compute_clause_selec(queryInfo, - get_clause((ClauseInfo) lfirst(cinfonode)), + get_clause((RestrictInfo) lfirst(cinfonode)), LispNil); } @@ -861,8 +861,8 @@ xfunc_find_references(LispValue clause) LispValue xfunc_primary_join(JoinPath pathnode) { - LispValue joinclauselist = get_pathclauseinfo(pathnode); - ClauseInfo mincinfo; + LispValue joinclauselist = get_pathrestrictinfo(pathnode); + RestrictInfo mincinfo; LispValue tmplist; LispValue minclause = LispNil; Cost minrank, @@ -903,15 +903,15 @@ xfunc_primary_join(JoinPath pathnode) if (joinclauselist == LispNil) return LispNil; - for (tmplist = joinclauselist, mincinfo = (ClauseInfo) lfirst(joinclauselist), - minrank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist))); + for (tmplist = joinclauselist, mincinfo = (RestrictInfo) lfirst(joinclauselist), + minrank = xfunc_rank(get_clause((RestrictInfo) lfirst(tmplist))); tmplist != LispNil; tmplist = lnext(tmplist)) - if ((tmprank = xfunc_rank(get_clause((ClauseInfo) lfirst(tmplist)))) + if ((tmprank = xfunc_rank(get_clause((RestrictInfo) lfirst(tmplist)))) < minrank) { minrank = tmprank; - mincinfo = (ClauseInfo) lfirst(tmplist); + mincinfo = (RestrictInfo) lfirst(tmplist); } return (LispValue) get_clause(mincinfo); } @@ -935,16 +935,16 @@ xfunc_get_path_cost(Query *queryInfo, Path pathnode) * functions, we don't sort. */ if (XfuncMode != XFUNC_OFF) - set_locclauseinfo(pathnode, lisp_qsort(get_locclauseinfo(pathnode), + set_locrestrictinfo(pathnode, lisp_qsort(get_loc_restrictinfo(pathnode), xfunc_cinfo_compare)); - for (tmplist = get_locclauseinfo(pathnode), selec = 1.0; + for (tmplist = get_loc_restrictinfo(pathnode), selec = 1.0; tmplist != LispNil; tmplist = lnext(tmplist)) { - cost += (Cost) (xfunc_local_expense(get_clause((ClauseInfo) lfirst(tmplist))) + cost += (Cost) (xfunc_local_expense(get_clause((RestrictInfo) lfirst(tmplist))) * (Cost) get_tuples(get_parent(pathnode)) * selec); selec *= compute_clause_selec(queryInfo, - get_clause((ClauseInfo) lfirst(tmplist)), + get_clause((RestrictInfo) lfirst(tmplist)), LispNil); } @@ -955,17 +955,17 @@ xfunc_get_path_cost(Query *queryInfo, Path pathnode) if (IsA(pathnode, JoinPath)) { if (XfuncMode != XFUNC_OFF) - set_pathclauseinfo((JoinPath) pathnode, lisp_qsort - (get_pathclauseinfo((JoinPath) pathnode), + set_pathrestrictinfo((JoinPath) pathnode, lisp_qsort + (get_pathrestrictinfo((JoinPath) pathnode), xfunc_cinfo_compare)); - for (tmplist = get_pathclauseinfo((JoinPath) pathnode), selec = 1.0; + for (tmplist = get_pathrestrictinfo((JoinPath) pathnode), selec = 1.0; tmplist != LispNil; tmplist = lnext(tmplist)) { - cost += (Cost) (xfunc_local_expense(get_clause((ClauseInfo) lfirst(tmplist))) + cost += (Cost) (xfunc_local_expense(get_clause((RestrictInfo) lfirst(tmplist))) * (Cost) get_tuples(get_parent(pathnode)) * selec); selec *= compute_clause_selec(queryInfo, - get_clause((ClauseInfo) lfirst(tmplist)), + get_clause((RestrictInfo) lfirst(tmplist)), LispNil); } } @@ -1188,14 +1188,14 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */ /* - ** Comparison function for lisp_qsort() on a list of ClauseInfo's. - ** arg1 and arg2 should really be of type (ClauseInfo *). + ** Comparison function for lisp_qsort() on a list of RestrictInfo's. + ** arg1 and arg2 should really be of type (RestrictInfo *). */ int xfunc_cinfo_compare(void *arg1, void *arg2) { - ClauseInfo info1 = *(ClauseInfo *) arg1; - ClauseInfo info2 = *(ClauseInfo *) arg2; + RestrictInfo info1 = *(RestrictInfo *) arg1; + RestrictInfo info2 = *(RestrictInfo *) arg2; LispValue clause1 = (LispValue) get_clause(info1), clause2 = (LispValue) get_clause(info2); @@ -1383,7 +1383,7 @@ xfunc_tuple_width(Relation rd) int xfunc_num_join_clauses(JoinPath path) { - int num = length(get_pathclauseinfo(path)); + int num = length(get_pathrestrictinfo(path)); if (IsA(path, MergePath)) return num + length(get_path_mergeclauses((MergePath) path)); @@ -1481,7 +1481,7 @@ xfunc_copyrel(RelOptInfo from, RelOptInfo * to) Node_Copy(from, newnode, alloc, indexkeys); Node_Copy(from, newnode, alloc, ordering); #endif - Node_Copy(from, newnode, alloc, clauseinfo); + Node_Copy(from, newnode, alloc, restrictinfo); Node_Copy(from, newnode, alloc, joininfo); Node_Copy(from, newnode, alloc, innerjoin); Node_Copy(from, newnode, alloc, superrels); |