mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +03:00
Change my-function-name-- to my_function_name, and optimizer renames.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* allpaths.c--
|
||||
* allpaths.c
|
||||
* Routines to find possible search paths for processing a query
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.30 1999/02/12 17:24:48 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.31 1999/02/13 23:16:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -52,7 +52,7 @@ static void debug_print_rel(Query *root, RelOptInfo *rel);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* find-paths--
|
||||
* find_paths
|
||||
* Finds all possible access paths for executing a query, returning the
|
||||
* top level list of relation entries.
|
||||
*
|
||||
@@ -96,7 +96,7 @@ find_paths(Query *root, List *rels)
|
||||
}
|
||||
|
||||
/*
|
||||
* find-rel-paths--
|
||||
* find_rel_paths
|
||||
* Finds all paths available for scanning each relation entry in
|
||||
* 'rels'. Sequential scan and any available indices are considered
|
||||
* if possible(indices are not considered for lower nesting levels).
|
||||
@@ -108,7 +108,6 @@ static void
|
||||
find_rel_paths(Query *root, List *rels)
|
||||
{
|
||||
List *temp;
|
||||
List *lastpath;
|
||||
|
||||
foreach(temp, rels)
|
||||
{
|
||||
@@ -132,13 +131,6 @@ find_rel_paths(Query *root, List *rels)
|
||||
append(rel_index_scan_list,
|
||||
or_index_scan_list));
|
||||
|
||||
/*
|
||||
* The unordered path is always the last in the list. If it is not
|
||||
* the cheapest path, prune it.
|
||||
*/
|
||||
lastpath = rel->pathlist;
|
||||
while (lnext(lastpath) != NIL)
|
||||
lastpath = lnext(lastpath);
|
||||
set_cheapest(rel, rel->pathlist);
|
||||
|
||||
/*
|
||||
@@ -153,7 +145,7 @@ find_rel_paths(Query *root, List *rels)
|
||||
}
|
||||
|
||||
/*
|
||||
* find-join-paths--
|
||||
* find_join_paths
|
||||
* Find all possible joinpaths for a query by successively finding ways
|
||||
* to join single relations into join relations.
|
||||
*
|
||||
@@ -161,10 +153,10 @@ find_rel_paths(Query *root, List *rels)
|
||||
* Find all possible joinpaths(bushy trees) for a query by systematically
|
||||
* finding ways to join relations(both original and derived) together.
|
||||
*
|
||||
* 'outer-rels' is the current list of relations for which join paths
|
||||
* 'outer_rels' is the current list of relations for which join paths
|
||||
* are to be found, i.e., he current list of relations that
|
||||
* have already been derived.
|
||||
* 'levels-needed' is the number of iterations needed
|
||||
* 'levels_needed' is the number of iterations needed
|
||||
*
|
||||
* Returns the final level of join relations, i.e., the relation that is
|
||||
* the result of joining all the original relations together.
|
||||
@@ -204,7 +196,7 @@ 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 'new_rels' accordingly, then eliminate redundant join
|
||||
* relations.
|
||||
*/
|
||||
new_rels = find_join_rels(root, outer_rels);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* clausesel.c--
|
||||
* clausesel.c
|
||||
* Routines to compute and set clause selectivities
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.16 1999/02/03 21:16:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.17 1999/02/13 23:16:15 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* costsize.c--
|
||||
* costsize.c
|
||||
* Routines to compute (and set) relation sizes and path costs
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.31 1999/02/12 17:24:49 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.32 1999/02/13 23:16:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -54,7 +54,7 @@ Cost _cpu_page_wight_ = _CPU_PAGE_WEIGHT_;
|
||||
Cost _cpu_index_page_wight_ = _CPU_INDEX_PAGE_WEIGHT_;
|
||||
|
||||
/*
|
||||
* cost_seqscan--
|
||||
* cost_seqscan
|
||||
* Determines and returns the cost of scanning a relation sequentially.
|
||||
* If the relation is a temporary to be materialized from a query
|
||||
* embedded within a data field (determined by 'relid' containing an
|
||||
@@ -100,7 +100,7 @@ cost_seqscan(int relid, int relpages, int reltuples)
|
||||
|
||||
|
||||
/*
|
||||
* cost_index--
|
||||
* cost_index
|
||||
* Determines and returns the cost of scanning a relation using an index.
|
||||
*
|
||||
* disk = expected-index-pages + expected-data-pages
|
||||
@@ -156,7 +156,7 @@ cost_index(Oid indexid,
|
||||
}
|
||||
|
||||
/*
|
||||
* cost_sort--
|
||||
* cost_sort
|
||||
* Determines and returns the cost of sorting a relation by considering
|
||||
* 1. the cost of doing an external sort: XXX this is probably too low
|
||||
* disk = (p lg p)
|
||||
@@ -206,7 +206,7 @@ cost_sort(List *pathkeys, int tuples, int width, bool noread)
|
||||
|
||||
|
||||
/*
|
||||
* cost_result--
|
||||
* cost_result
|
||||
* Determines and returns the cost of writing a relation of 'tuples'
|
||||
* tuples of 'width' bytes out to a result relation.
|
||||
*
|
||||
@@ -228,7 +228,7 @@ cost_result(int tuples, int width)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* cost_nestloop--
|
||||
* cost_nestloop
|
||||
* Determines and returns the cost of joining two relations using the
|
||||
* nested loop algorithm.
|
||||
*
|
||||
@@ -259,7 +259,7 @@ cost_nestloop(Cost outercost,
|
||||
}
|
||||
|
||||
/*
|
||||
* cost_mergejoin--
|
||||
* cost_mergejoin
|
||||
* 'outercost' and 'innercost' are the (disk+cpu) costs of scanning the
|
||||
* outer and inner relations
|
||||
* 'outersortkeys' and 'innersortkeys' are lists of the keys to be used
|
||||
@@ -350,8 +350,8 @@ cost_hashjoin(Cost outercost,
|
||||
}
|
||||
|
||||
/*
|
||||
* compute-rel-size--
|
||||
* Computes the size of each relation in 'rel-list' (after applying
|
||||
* compute_rel_size
|
||||
* Computes the size of each relation in 'rel_list' (after applying
|
||||
* restrictions), by multiplying the selectivity of each restriction
|
||||
* by the original size of the relation.
|
||||
*
|
||||
@@ -377,7 +377,7 @@ compute_rel_size(RelOptInfo *rel)
|
||||
}
|
||||
|
||||
/*
|
||||
* compute-rel-width--
|
||||
* compute_rel_width
|
||||
* Computes the width in bytes of a tuple from 'rel'.
|
||||
*
|
||||
* Returns the width of the tuple as a fixnum.
|
||||
@@ -389,7 +389,7 @@ compute_rel_width(RelOptInfo *rel)
|
||||
}
|
||||
|
||||
/*
|
||||
* compute-targetlist-width--
|
||||
* compute_targetlist_width
|
||||
* Computes the width in bytes of a tuple made from 'targetlist'.
|
||||
*
|
||||
* Returns the width of the tuple as a fixnum.
|
||||
@@ -409,7 +409,7 @@ compute_targetlist_width(List *targetlist)
|
||||
}
|
||||
|
||||
/*
|
||||
* compute-attribute-width--
|
||||
* compute_attribute_width
|
||||
* Given a target list entry, find the size in bytes of the attribute.
|
||||
*
|
||||
* If a field is variable-length, it is assumed to be at least the size
|
||||
@@ -429,7 +429,7 @@ compute_attribute_width(TargetEntry *tlistentry)
|
||||
}
|
||||
|
||||
/*
|
||||
* compute-joinrel-size--
|
||||
* compute_joinrel_size
|
||||
* Computes the size of the join relation 'joinrel'.
|
||||
*
|
||||
* Returns a fixnum.
|
||||
@@ -461,7 +461,7 @@ compute_joinrel_size(JoinPath *joinpath)
|
||||
}
|
||||
|
||||
/*
|
||||
* page-size--
|
||||
* page_size
|
||||
* Returns an estimate of the number of pages covered by a given
|
||||
* number of tuples of a given width (size in bytes).
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* hashutils.c--
|
||||
* hashutils.c
|
||||
* Utilities for finding applicable merge clauses and pathkeys
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.12 1999/02/10 03:52:39 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.13 1999/02/13 23:16:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -23,13 +23,13 @@
|
||||
static HashInfo *match_hashop_hashinfo(Oid hashop, List *hashinfo_list);
|
||||
|
||||
/*
|
||||
* group-clauses-by-hashop--
|
||||
* If a join clause node in 'restrictinfo-list' is hashjoinable, store
|
||||
* group_clauses_by_hashop
|
||||
* 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.
|
||||
*
|
||||
* 'restrictinfo-list' is the list of restrictinfo nodes
|
||||
* 'inner-relid' is the relid of the inner join relation
|
||||
* '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.
|
||||
*
|
||||
@@ -49,7 +49,7 @@ group_clauses_by_hashop(List *restrictinfo_list,
|
||||
hashjoinop = restrictinfo->hashjoinoperator;
|
||||
|
||||
/*
|
||||
* Create a new hashinfo node and add it to 'hashinfo-list' if one
|
||||
* Create a new hashinfo node and add it to 'hashinfo_list' if one
|
||||
* does not yet exist for this hash operator.
|
||||
*/
|
||||
if (hashjoinop)
|
||||
@@ -98,8 +98,8 @@ group_clauses_by_hashop(List *restrictinfo_list,
|
||||
|
||||
|
||||
/*
|
||||
* match-hashop-hashinfo--
|
||||
* Searches the list 'hashinfo-list' for a hashinfo node whose hash op
|
||||
* match_hashop_hashinfo
|
||||
* Searches the list 'hashinfo_list' for a hashinfo node whose hash op
|
||||
* field equals 'hashop'.
|
||||
*
|
||||
* Returns the node if it exists.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* indxpath.c--
|
||||
* indxpath.c
|
||||
* Routines to determine which indices are usable for scanning a
|
||||
* given relation
|
||||
*
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.43 1999/02/11 14:58:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.44 1999/02/13 23:16:16 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -56,7 +56,7 @@ static List *group_clauses_by_indexkey(RelOptInfo *rel, RelOptInfo *index,
|
||||
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 RestrictInfo *match_clause_to_indexkey(RelOptInfo *rel, RelOptInfo *index, int indexkey,
|
||||
int xclass, RestrictInfo * restrictInfo, bool join);
|
||||
int xclass, RestrictInfo *restrictInfo, bool join);
|
||||
static bool pred_test(List *predicate_list, List *restrictinfo_list,
|
||||
List *joininfo_list);
|
||||
static bool one_pred_test(Expr *predicate, List *restrictinfo_list);
|
||||
@@ -90,8 +90,8 @@ 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
|
||||
* 'restrictinfo-list' is a list of restriction restrictinfo nodes for 'rel'
|
||||
* 'joininfo-list' is a list of joininfo 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))
|
||||
*
|
||||
@@ -200,7 +200,7 @@ find_index_paths(Query *root,
|
||||
|
||||
|
||||
/*
|
||||
* match-index-orclauses--
|
||||
* match_index_orclauses
|
||||
* Attempt to match an index against subclauses within 'or' clauses.
|
||||
* If the index does match, then the clause is marked with information
|
||||
* about the index.
|
||||
@@ -212,7 +212,7 @@ find_index_paths(Query *root,
|
||||
* 'index' is the index node.
|
||||
* 'indexkey' is the (single) key of the index
|
||||
* 'class' is the class of the operator corresponding to 'indexkey'.
|
||||
* 'restrictinfo-list' is the list of available restriction clauses.
|
||||
* 'restrictinfo_list' is the list of available restriction clauses.
|
||||
*
|
||||
* Returns nothing.
|
||||
*
|
||||
@@ -276,7 +276,7 @@ match_index_to_operand(int indexkey,
|
||||
}
|
||||
|
||||
/*
|
||||
* match-index-orclause--
|
||||
* match_index_orclause
|
||||
* Attempts to match an index against the subclauses of an 'or' clause.
|
||||
*
|
||||
* A match means that:
|
||||
@@ -285,8 +285,8 @@ match_index_to_operand(int indexkey,
|
||||
* (2) there is a usable key that matches the variable within a
|
||||
* searchable clause.
|
||||
*
|
||||
* 'or-clauses' are the remaining subclauses within the 'or' clause
|
||||
* 'other-matching-indices' is the list of information on other indices
|
||||
* 'or_clauses' are the remaining subclauses within the 'or' clause
|
||||
* 'other_matching_indices' is the list of information on other indices
|
||||
* that have already been matched to subclauses within this
|
||||
* particular 'or' clause (i.e., a list previously generated by
|
||||
* this routine)
|
||||
@@ -364,7 +364,7 @@ match_index_orclause(RelOptInfo *rel,
|
||||
(index->indproc != InvalidOid))
|
||||
|
||||
/*
|
||||
* group-clauses-by-indexkey--
|
||||
* group_clauses_by_indexkey
|
||||
* Determines whether there are clauses which will match each and every
|
||||
* one of the remaining keys of an index.
|
||||
*
|
||||
@@ -442,8 +442,8 @@ group_clauses_by_indexkey(RelOptInfo *rel,
|
||||
}
|
||||
|
||||
/*
|
||||
* group-clauses-by-ikey-for-joins--
|
||||
* special edition of group-clauses-by-indexkey - will
|
||||
* group_clauses_by_ikey_for_joins
|
||||
* special edition of group_clauses_by_indexkey - will
|
||||
* match join & restriction clauses. See comment in indexable_joinclauses.
|
||||
* - vadim 03/18/97
|
||||
*
|
||||
@@ -771,7 +771,7 @@ match_clause_to_indexkey(RelOptInfo *rel,
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* pred_test--
|
||||
* pred_test
|
||||
* Does the "predicate inclusion test" for partial indexes.
|
||||
*
|
||||
* Recursively checks whether the clauses in restrictinfo_list imply
|
||||
@@ -831,7 +831,7 @@ pred_test(List *predicate_list, List *restrictinfo_list, List *joininfo_list)
|
||||
|
||||
|
||||
/*
|
||||
* one_pred_test--
|
||||
* one_pred_test
|
||||
* Does the "predicate inclusion test" for one conjunct of a predicate
|
||||
* expression.
|
||||
*/
|
||||
@@ -854,7 +854,7 @@ one_pred_test(Expr *predicate, List *restrictinfo_list)
|
||||
|
||||
|
||||
/*
|
||||
* one_pred_clause_expr_test--
|
||||
* one_pred_clause_expr_test
|
||||
* Does the "predicate inclusion test" for a general restriction-clause
|
||||
* expression.
|
||||
*/
|
||||
@@ -901,7 +901,7 @@ one_pred_clause_expr_test(Expr *predicate, Node *clause)
|
||||
|
||||
|
||||
/*
|
||||
* one_pred_clause_test--
|
||||
* one_pred_clause_test
|
||||
* Does the "predicate inclusion test" for one conjunct of a predicate
|
||||
* expression for a simple restriction clause.
|
||||
*/
|
||||
@@ -978,7 +978,7 @@ StrategyNumber BT_implic_table[BTMaxStrategyNumber][BTMaxStrategyNumber] = {
|
||||
|
||||
|
||||
/*
|
||||
* clause_pred_clause_test--
|
||||
* clause_pred_clause_test
|
||||
* Use operator class info to check whether clause implies predicate.
|
||||
*
|
||||
* Does the "predicate inclusion test" for a "simple clause" predicate
|
||||
@@ -1168,8 +1168,8 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* indexable-joinclauses--
|
||||
* Finds all groups of join clauses from among 'joininfo-list' that can
|
||||
* indexable_joinclauses
|
||||
* Finds all groups of join clauses from among 'joininfo_list' that can
|
||||
* be used in conjunction with 'index'.
|
||||
*
|
||||
* The first clause in the group is marked as having the other relation
|
||||
@@ -1244,7 +1244,7 @@ extract_restrict_clauses(List *clausegroup)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* index-innerjoin--
|
||||
* index_innerjoin
|
||||
* Creates index path nodes corresponding to paths to be used as inner
|
||||
* relations in nestloop joins.
|
||||
*
|
||||
@@ -1330,7 +1330,7 @@ index_innerjoin(Query *root, RelOptInfo *rel, List *clausegroup_list,
|
||||
}
|
||||
|
||||
/*
|
||||
* create-index-paths--
|
||||
* create_index_paths
|
||||
* Creates a list of index path nodes for each group of clauses
|
||||
* (restriction or join) that can be used in conjunction with an index.
|
||||
*
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* joinpath.c--
|
||||
* joinpath.c
|
||||
* Routines to find all possible paths for processing a set of joins
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.22 1999/02/12 17:24:49 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.23 1999/02/13 23:16:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -42,7 +42,7 @@ static List *hash_inner_and_outer(RelOptInfo *joinrel, RelOptInfo *outerrel, Rel
|
||||
List *hashinfo_list);
|
||||
|
||||
/*
|
||||
* find-all-join-paths--
|
||||
* find_all_join_paths
|
||||
* Creates all possible ways to process joins for each of the join
|
||||
* relations in the list 'joinrels.' Each unique path will be included
|
||||
* in the join relation's 'pathlist' field.
|
||||
@@ -131,7 +131,7 @@ find_all_join_paths(Query *root, List *joinrels)
|
||||
* 3. Consider paths where the inner relation need not be
|
||||
* explicitly sorted. This may include nestloops and mergejoins
|
||||
* the actual nestloop nodes were constructed in
|
||||
* (match-unsorted-outer).
|
||||
* (match_unsorted_outer).
|
||||
*/
|
||||
pathlist = add_pathlist(joinrel, pathlist,
|
||||
match_unsorted_inner(joinrel, outerrel,
|
||||
@@ -152,8 +152,8 @@ find_all_join_paths(Query *root, List *joinrels)
|
||||
|
||||
/*
|
||||
* '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
|
||||
* (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;
|
||||
@@ -180,13 +180,13 @@ find_all_join_paths(Query *root, List *joinrels)
|
||||
}
|
||||
|
||||
/*
|
||||
* best-innerjoin--
|
||||
* best_innerjoin
|
||||
* Find the cheapest index path that has already been identified by
|
||||
* (indexable_joinclauses) as being a possible inner path for the given
|
||||
* outer relation in a nestloop join.
|
||||
*
|
||||
* 'join-paths' is a list of join nodes
|
||||
* 'outer-relid' is the relid of the outer join relation
|
||||
* 'join_paths' is a list of join nodes
|
||||
* 'outer_relid' is the relid of the outer join relation
|
||||
*
|
||||
* Returns the pathnode of the selected path.
|
||||
*/
|
||||
@@ -212,14 +212,14 @@ best_innerjoin(List *join_paths, List *outer_relids)
|
||||
}
|
||||
|
||||
/*
|
||||
* sort-inner-and-outer--
|
||||
* sort_inner_and_outer
|
||||
* Create mergejoin join paths by explicitly sorting both the outer and
|
||||
* inner join relations on each available merge ordering.
|
||||
*
|
||||
* 'joinrel' is the join relation
|
||||
* 'outerrel' is the outer join relation
|
||||
* 'innerrel' is the inner join relation
|
||||
* 'mergeinfo-list' is a list of nodes containing info on(mergejoinable)
|
||||
* 'mergeinfo_list' is a list of nodes containing info on(mergejoinable)
|
||||
* clauses for joining the relations
|
||||
*
|
||||
* Returns a list of mergejoin paths.
|
||||
@@ -272,7 +272,7 @@ sort_inner_and_outer(RelOptInfo *joinrel,
|
||||
}
|
||||
|
||||
/*
|
||||
* match-unsorted-outer--
|
||||
* match_unsorted_outer
|
||||
* Creates possible join paths for processing a single join relation
|
||||
* 'joinrel' by employing either iterative substitution or
|
||||
* mergejoining on each of its possible outer paths(assuming that the
|
||||
@@ -290,10 +290,10 @@ sort_inner_and_outer(RelOptInfo *joinrel,
|
||||
* 'joinrel' is the join relation
|
||||
* 'outerrel' is the outer join relation
|
||||
* 'innerrel' is the inner join relation
|
||||
* 'outerpath-list' is the list of possible outer paths
|
||||
* 'cheapest-inner' is the cheapest inner path
|
||||
* 'best-innerjoin' is the best inner index path(if any)
|
||||
* 'mergeinfo-list' is a list of nodes containing info on mergejoinable
|
||||
* 'outerpath_list' is the list of possible outer paths
|
||||
* 'cheapest_inner' is the cheapest inner path
|
||||
* 'best_innerjoin' is the best inner index path(if any)
|
||||
* 'mergeinfo_list' is a list of nodes containing info on mergejoinable
|
||||
* clauses
|
||||
*
|
||||
* Returns a list of possible join path nodes.
|
||||
@@ -391,7 +391,7 @@ match_unsorted_outer(RelOptInfo *joinrel,
|
||||
/*
|
||||
* Keep track of the cost of the outer path used with this
|
||||
* ordered inner path for later processing in
|
||||
* (match-unsorted-inner), since it isn't a sort and thus
|
||||
* (match_unsorted_inner), since it isn't a sort and thus
|
||||
* wouldn't otherwise be considered.
|
||||
*/
|
||||
if (path_is_cheaper_than_sort)
|
||||
@@ -421,23 +421,23 @@ match_unsorted_outer(RelOptInfo *joinrel,
|
||||
}
|
||||
|
||||
/*
|
||||
* match-unsorted-inner --
|
||||
* match_unsorted_inner
|
||||
* Find the cheapest ordered join path for a given(ordered, unsorted)
|
||||
* inner join path.
|
||||
*
|
||||
* Scans through each path available on an inner join relation and tries
|
||||
* matching its ordering keys against those of mergejoin clauses.
|
||||
* If 1. an appropriately-ordered inner path and matching mergeclause are
|
||||
* If 1. an appropriately_ordered inner path and matching mergeclause are
|
||||
* found, and
|
||||
* 2. sorting the cheapest outer path is cheaper than using an ordered
|
||||
* but unsorted outer path(as was considered in
|
||||
* (match-unsorted-outer)), then this merge path is considered.
|
||||
* (match_unsorted_outer)), then this merge path is considered.
|
||||
*
|
||||
* 'joinrel' is the join result relation
|
||||
* 'outerrel' is the outer join relation
|
||||
* 'innerrel' is the inner join relation
|
||||
* 'innerpath-list' is the list of possible inner join paths
|
||||
* 'mergeinfo-list' is a list of nodes containing info on mergejoinable
|
||||
* 'innerpath_list' is the list of possible inner join paths
|
||||
* 'mergeinfo_list' is a list of nodes containing info on mergejoinable
|
||||
* clauses
|
||||
*
|
||||
* Returns a list of possible merge paths.
|
||||
@@ -490,7 +490,7 @@ match_unsorted_inner(RelOptInfo *joinrel,
|
||||
}
|
||||
|
||||
/*
|
||||
* (match-unsorted-outer) if it is applicable. 'OuterJoinCost was
|
||||
* (match_unsorted_outer) if it is applicable. 'OuterJoinCost was
|
||||
* set above in
|
||||
*/
|
||||
if (clauses && matchedJoinKeys)
|
||||
@@ -555,14 +555,14 @@ EnoughMemoryForHashjoin(RelOptInfo *hashrel)
|
||||
}
|
||||
|
||||
/*
|
||||
* hash-inner-and-outer-- XXX HASH
|
||||
* hash_inner_and_outer-- XXX HASH
|
||||
* Create hashjoin join paths by explicitly hashing both the outer and
|
||||
* inner join relations on each available hash op.
|
||||
*
|
||||
* 'joinrel' is the join relation
|
||||
* 'outerrel' is the outer join relation
|
||||
* 'innerrel' is the inner join relation
|
||||
* 'hashinfo-list' is a list of nodes containing info on(hashjoinable)
|
||||
* 'hashinfo_list' is a list of nodes containing info on(hashjoinable)
|
||||
* clauses for joining the relations
|
||||
*
|
||||
* Returns a list of hashjoin paths.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* joinrels.c--
|
||||
* joinrels.c
|
||||
* Routines to determine which relations should be joined
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.19 1999/02/12 05:56:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.20 1999/02/13 23:16:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -44,15 +44,15 @@ static void set_joinrel_size(RelOptInfo *joinrel, RelOptInfo *outer_rel, RelOptI
|
||||
JoinInfo * jinfo);
|
||||
|
||||
/*
|
||||
* find-join-rels--
|
||||
* find_join_rels
|
||||
* Find all possible joins for each of the outer join relations in
|
||||
* 'outer-rels'. A rel node is created for each possible join relation,
|
||||
* 'outer_rels'. A rel node is created for each possible join relation,
|
||||
* and the resulting list of nodes is returned. If at all possible, only
|
||||
* those relations for which join clauses exist are considered. If none
|
||||
* of these exist for a given relation, all remaining possibilities are
|
||||
* considered.
|
||||
*
|
||||
* 'outer-rels' is the list of rel nodes
|
||||
* 'outer_rels' is the list of rel nodes
|
||||
*
|
||||
* Returns a list of rel nodes corresponding to the new join relations.
|
||||
*/
|
||||
@@ -82,16 +82,16 @@ find_join_rels(Query *root, List *outer_rels)
|
||||
}
|
||||
|
||||
/*
|
||||
* find-clause-joins--
|
||||
* find_clause_joins
|
||||
* Determines whether joins can be performed between an outer relation
|
||||
* 'outer-rel' and those relations within 'outer-rel's joininfo nodes
|
||||
* (i.e., relations that participate in join clauses that 'outer-rel'
|
||||
* 'outer_rel' and those relations within 'outer_rel's joininfo nodes
|
||||
* (i.e., relations that participate in join clauses that 'outer_rel'
|
||||
* participates in). This is possible if all but one of the relations
|
||||
* contained within the join clauses of the joininfo node are already
|
||||
* contained within 'outer-rel'.
|
||||
* contained within 'outer_rel'.
|
||||
*
|
||||
* 'outer-rel' is the relation entry for the outer relation
|
||||
* 'joininfo-list' is a list of join clauses which 'outer-rel'
|
||||
* 'outer_rel' is the relation entry for the outer relation
|
||||
* 'joininfo_list' is a list of join clauses which 'outer_rel'
|
||||
* participates in
|
||||
*
|
||||
* Returns a list of new join relations.
|
||||
@@ -148,10 +148,10 @@ find_clause_joins(Query *root, RelOptInfo *outer_rel, List *joininfo_list)
|
||||
}
|
||||
|
||||
/*
|
||||
* find-clauseless-joins--
|
||||
* Given an outer relation 'outer-rel' and a list of inner relations
|
||||
* 'inner-rels', create a join relation between 'outer-rel' and each
|
||||
* member of 'inner-rels' that isn't already included in 'outer-rel'.
|
||||
* find_clauseless_joins
|
||||
* Given an outer relation 'outer_rel' and a list of inner relations
|
||||
* 'inner_rels', create a join relation between 'outer_rel' and each
|
||||
* member of 'inner_rels' that isn't already included in 'outer_rel'.
|
||||
*
|
||||
* Returns a list of new join relations.
|
||||
*/
|
||||
@@ -180,13 +180,13 @@ find_clauseless_joins(RelOptInfo *outer_rel, List *inner_rels)
|
||||
}
|
||||
|
||||
/*
|
||||
* init-join-rel--
|
||||
* init_join_rel
|
||||
* Creates and initializes a new join relation.
|
||||
*
|
||||
* 'outer-rel' and 'inner-rel' are relation nodes for the relations to be
|
||||
* 'outer_rel' and 'inner_rel' are relation nodes for the relations to be
|
||||
* joined
|
||||
* 'joininfo' is the joininfo node(join clause) containing both
|
||||
* 'outer-rel' and 'inner-rel', if any exists
|
||||
* 'outer_rel' and 'inner_rel', if any exists
|
||||
*
|
||||
* Returns the new join relation node.
|
||||
*/
|
||||
@@ -251,17 +251,17 @@ init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo * joininfo)
|
||||
}
|
||||
|
||||
/*
|
||||
* new-join-tlist--
|
||||
* new_join_tlist
|
||||
* Builds a join relations's target list by keeping those elements that
|
||||
* will be in the final target list and any other elements that are still
|
||||
* needed for future joins. For a target list entry to still be needed
|
||||
* for future joins, its 'joinlist' field must not be empty after removal
|
||||
* of all relids in 'other-relids'.
|
||||
* of all relids in 'other_relids'.
|
||||
*
|
||||
* 'tlist' is the target list of one of the join relations
|
||||
* 'other-relids' is a list of relids contained within the other
|
||||
* 'other_relids' is a list of relids contained within the other
|
||||
* join relation
|
||||
* 'first-resdomno' is the resdom number to use for the first created
|
||||
* 'first_resdomno' is the resdom number to use for the first created
|
||||
* target list entry
|
||||
*
|
||||
* Returns the new target list.
|
||||
@@ -298,19 +298,19 @@ new_join_tlist(List *tlist,
|
||||
}
|
||||
|
||||
/*
|
||||
* new-joininfo-list--
|
||||
* new_joininfo_list
|
||||
* Builds a join relation's joininfo list by checking for join clauses
|
||||
* which still need to used in future joins involving this relation. A
|
||||
* join clause is still needed if there are still relations in the clause
|
||||
* not contained in the list of relations comprising this join relation.
|
||||
* New joininfo nodes are only created and added to
|
||||
* 'current-joininfo-list' if a node for a particular join hasn't already
|
||||
* 'current_joininfo_list' if a node for a particular join hasn't already
|
||||
* been created.
|
||||
*
|
||||
* 'current-joininfo-list' contains a list of those joininfo nodes that
|
||||
* 'current_joininfo_list' contains a list of those joininfo nodes that
|
||||
* have already been built
|
||||
* 'joininfo-list' is the list of join clauses involving this relation
|
||||
* 'join-relids' is a list of relids corresponding to the relations
|
||||
* 'joininfo_list' is the list of join clauses involving this relation
|
||||
* 'join_relids' is a list of relids corresponding to the relations
|
||||
* currently being joined
|
||||
*
|
||||
* Returns a list of joininfo nodes, new and old.
|
||||
@@ -364,7 +364,7 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
|
||||
}
|
||||
|
||||
/*
|
||||
* add-new-joininfos--
|
||||
* add_new_joininfos
|
||||
* For each new join relation, create new joininfos that
|
||||
* use the join relation as inner relation, and add
|
||||
* the new joininfos to those rel nodes that still
|
||||
@@ -462,11 +462,11 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
}
|
||||
|
||||
/*
|
||||
* final-join-rels--
|
||||
* final_join_rels
|
||||
* Find the join relation that includes all the original
|
||||
* relations, i.e. the final join result.
|
||||
*
|
||||
* 'join-rel-list' is a list of join relations.
|
||||
* 'join_rel_list' is a list of join relations.
|
||||
*
|
||||
* Returns the list of final join relations.
|
||||
*/
|
||||
@@ -508,11 +508,11 @@ final_join_rels(List *join_rel_list)
|
||||
}
|
||||
|
||||
/*
|
||||
* add_superrels--
|
||||
* add_superrels
|
||||
* add rel to the temporary property list superrels.
|
||||
*
|
||||
* 'rel' a rel node
|
||||
* 'super-rel' rel node of a join relation that includes rel
|
||||
* 'super_rel' rel node of a join relation that includes rel
|
||||
*
|
||||
* Modifies the superrels field of rel
|
||||
*/
|
||||
@@ -523,7 +523,7 @@ add_superrels(RelOptInfo *rel, RelOptInfo *super_rel)
|
||||
}
|
||||
|
||||
/*
|
||||
* nonoverlap-rels--
|
||||
* nonoverlap_rels
|
||||
* test if two join relations overlap, i.e., includes the same
|
||||
* relation.
|
||||
*
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* joinutils.c--
|
||||
* joinutils.c
|
||||
* Utilities for matching and building join and path keys
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.19 1999/02/11 17:00:48 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/joinutils.c,v 1.20 1999/02/13 23:16:19 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ static List *new_matching_subkeys(Var *subkey, List *considered_subkeys,
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* match-pathkeys-joinkeys--
|
||||
* match_pathkeys_joinkeys
|
||||
* Attempts to match the keys of a path against the keys of join clauses.
|
||||
* This is done by looking for a matching join key in 'joinkeys' for
|
||||
* every path key in the list 'path.keys'. If there is a matching join key
|
||||
@@ -54,7 +54,7 @@ static List *new_matching_subkeys(Var *subkey, List *considered_subkeys,
|
||||
* ( (outer inner) (outer inner) ... )
|
||||
* 'joinclauses' is a list of clauses corresponding to the join keys in
|
||||
* 'joinkeys'
|
||||
* 'which-subkey' is a flag that selects the desired subkey of a join key
|
||||
* 'which_subkey' is a flag that selects the desired subkey of a join key
|
||||
* in 'joinkeys'
|
||||
*
|
||||
* Returns the join keys and corresponding join clauses in a list if all
|
||||
@@ -112,7 +112,7 @@ match_pathkeys_joinkeys(List *pathkeys,
|
||||
}
|
||||
|
||||
/*
|
||||
* match-pathkey-joinkeys--
|
||||
* match_pathkey_joinkeys
|
||||
* Returns the 0-based index into 'joinkeys' of the first joinkey whose
|
||||
* outer or inner subkey matches any subkey of 'pathkey'.
|
||||
*/
|
||||
@@ -144,7 +144,7 @@ match_pathkey_joinkeys(List *pathkey,
|
||||
}
|
||||
|
||||
/*
|
||||
* match-paths-joinkeys--
|
||||
* match_paths_joinkeys
|
||||
* Attempts to find a path in 'paths' whose keys match a set of join
|
||||
* keys 'joinkeys'. To match,
|
||||
* 1. the path node ordering must equal 'ordering'.
|
||||
@@ -159,7 +159,7 @@ match_pathkey_joinkeys(List *pathkey,
|
||||
* must correspond
|
||||
* 'paths' is a list of(inner) paths which are to be matched against
|
||||
* each join key in 'joinkeys'
|
||||
* 'which-subkey' is a flag that selects the desired subkey of a join key
|
||||
* 'which_subkey' is a flag that selects the desired subkey of a join key
|
||||
* in 'joinkeys'
|
||||
*
|
||||
* Returns the matching path node if one exists, nil otherwise.
|
||||
@@ -238,14 +238,14 @@ match_paths_joinkeys(List *joinkeys,
|
||||
|
||||
|
||||
/*
|
||||
* extract-path-keys--
|
||||
* extract_path_keys
|
||||
* Builds a subkey list for a path by pulling one of the subkeys from
|
||||
* a list of join keys 'joinkeys' and then finding the var node in the
|
||||
* target list 'tlist' that corresponds to that subkey.
|
||||
*
|
||||
* 'joinkeys' is a list of join key pairs
|
||||
* 'tlist' is a relation target list
|
||||
* 'which-subkey' is a flag that selects the desired subkey of a join key
|
||||
* 'which_subkey' is a flag that selects the desired subkey of a join key
|
||||
* in 'joinkeys'
|
||||
*
|
||||
* Returns a list of pathkeys: ((tlvar1)(tlvar2)...(tlvarN)).
|
||||
@@ -296,7 +296,7 @@ extract_path_keys(List *joinkeys,
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* new-join-pathkeys--
|
||||
* new_join_pathkeys
|
||||
* Find the path keys for a join relation by finding all vars in the list
|
||||
* of join clauses 'joinclauses' such that:
|
||||
* (1) the var corresponding to the outer join relation is a
|
||||
@@ -305,8 +305,8 @@ extract_path_keys(List *joinkeys,
|
||||
* In other words, add to each outer path key the inner path keys that
|
||||
* are required for qualification.
|
||||
*
|
||||
* 'outer-pathkeys' is the list of the outer path's path keys
|
||||
* 'join-rel-tlist' is the target list of the join relation
|
||||
* 'outer_pathkeys' is the list of the outer path's path keys
|
||||
* 'join_rel_tlist' is the target list of the join relation
|
||||
* 'joinclauses' is the list of restricting join clauses
|
||||
*
|
||||
* Returns the list of new path keys.
|
||||
@@ -333,17 +333,17 @@ new_join_pathkeys(List *outer_pathkeys,
|
||||
}
|
||||
|
||||
/*
|
||||
* new-join-pathkey--
|
||||
* new_join_pathkey
|
||||
* Finds new vars that become subkeys due to qualification clauses that
|
||||
* contain any previously considered subkeys. These new subkeys plus the
|
||||
* subkeys from 'subkeys' form a new pathkey for the join relation.
|
||||
*
|
||||
* Note that each returned subkey is the var node found in
|
||||
* 'join-rel-tlist' rather than the joinclause var node.
|
||||
* 'join_rel_tlist' rather than the joinclause var node.
|
||||
*
|
||||
* 'subkeys' is a list of subkeys for which matching subkeys are to be
|
||||
* found
|
||||
* 'considered-subkeys' is the current list of all subkeys corresponding
|
||||
* 'considered_subkeys' is the current list of all subkeys corresponding
|
||||
* to a given pathkey
|
||||
*
|
||||
* Returns a new pathkey(list of subkeys).
|
||||
@@ -388,15 +388,15 @@ new_join_pathkey(List *subkeys,
|
||||
}
|
||||
|
||||
/*
|
||||
* new-matching-subkeys--
|
||||
* new_matching_subkeys
|
||||
* Returns a list of new subkeys:
|
||||
* (1) which are not listed in 'considered-subkeys'
|
||||
* (1) which are not listed in 'considered_subkeys'
|
||||
* (2) for which the "other" variable in some clause in 'joinclauses' is
|
||||
* 'subkey'
|
||||
* (3) which are mentioned in 'join-rel-tlist'
|
||||
* (3) which are mentioned in 'join_rel_tlist'
|
||||
*
|
||||
* Note that each returned subkey is the var node found in
|
||||
* 'join-rel-tlist' rather than the joinclause var node.
|
||||
* 'join_rel_tlist' rather than the joinclause var node.
|
||||
*
|
||||
* 'subkey' is the var node for which we are trying to find matching
|
||||
* clauses
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* mergeutils.c--
|
||||
* mergeutils.c
|
||||
* Utilities for finding applicable merge clauses and pathkeys
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.17 1999/02/11 14:58:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.18 1999/02/13 23:16:20 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -22,13 +22,13 @@
|
||||
#include "optimizer/ordering.h"
|
||||
|
||||
/*
|
||||
* group-clauses-by-order--
|
||||
* If a join clause node in 'restrictinfo-list' is mergejoinable, store
|
||||
* group_clauses_by_order
|
||||
* 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.
|
||||
*
|
||||
* 'restrictinfo-list' is the list of restrictinfo nodes
|
||||
* 'inner-relid' is the relid of the inner join relation
|
||||
* '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.
|
||||
*
|
||||
@@ -49,7 +49,7 @@ group_clauses_by_order(List *restrictinfo_list,
|
||||
{
|
||||
|
||||
/*
|
||||
* Create a new mergeinfo node and add it to 'mergeinfo-list'
|
||||
* Create a new mergeinfo node and add it to 'mergeinfo_list'
|
||||
* if one does not yet exist for this merge ordering.
|
||||
*/
|
||||
PathOrder *pathorder;
|
||||
@@ -96,8 +96,8 @@ group_clauses_by_order(List *restrictinfo_list,
|
||||
|
||||
|
||||
/*
|
||||
* match-order-mergeinfo--
|
||||
* Searches the list 'mergeinfo-list' for a mergeinfo node whose order
|
||||
* match_order_mergeinfo
|
||||
* Searches the list 'mergeinfo_list' for a mergeinfo node whose order
|
||||
* field equals 'ordering'.
|
||||
*
|
||||
* Returns the node if it exists.
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* orindxpath.c--
|
||||
* orindxpath.c
|
||||
* Routines to find index paths that match a set of 'or' clauses
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.19 1999/02/11 14:58:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.20 1999/02/13 23:16:21 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ static void best_or_subclause_index(Query *root, RelOptInfo *rel, Expr *subclaus
|
||||
|
||||
|
||||
/*
|
||||
* create-or-index-paths--
|
||||
* create_or_index_paths
|
||||
* Creates index paths for indices that match 'or' clauses.
|
||||
*
|
||||
* 'rel' is the relation entry for which the paths are to be defined on
|
||||
@@ -142,7 +142,7 @@ create_or_index_paths(Query *root,
|
||||
}
|
||||
|
||||
/*
|
||||
* best-or-subclause-indices--
|
||||
* best_or_subclause_indices
|
||||
* Determines the best index to be used in conjunction with each subclause
|
||||
* of an 'or' clause and the cost of scanning a relation using these
|
||||
* indices. The cost is the sum of the individual index costs.
|
||||
@@ -151,9 +151,9 @@ create_or_index_paths(Query *root,
|
||||
* 'subclauses' are the subclauses of the 'or' clause
|
||||
* 'indices' are those index nodes that matched subclauses of the 'or'
|
||||
* clause
|
||||
* 'examined-indexids' is a list of those index ids to be used with
|
||||
* 'examined_indexids' is a list of those index ids to be used with
|
||||
* subclauses that have already been examined
|
||||
* 'subcost' is the cost of using the indices in 'examined-indexids'
|
||||
* 'subcost' is the cost of using the indices in 'examined_indexids'
|
||||
* 'selectivities' is a list of the selectivities of subclauses that
|
||||
* have already been examined
|
||||
*
|
||||
@@ -199,7 +199,7 @@ best_or_subclause_indices(Query *root,
|
||||
}
|
||||
|
||||
/*
|
||||
* best-or-subclause-index--
|
||||
* best_or_subclause_index
|
||||
* Determines which is the best index to be used with a subclause of
|
||||
* an 'or' clause by estimating the cost of using each index and selecting
|
||||
* the least expensive.
|
||||
@@ -208,7 +208,7 @@ best_or_subclause_indices(Query *root,
|
||||
* 'subclause' is the subclause
|
||||
* 'indices' is a list of index nodes that match the subclause
|
||||
*
|
||||
* Returns a list (index-id index-subcost index-selectivity)
|
||||
* Returns a list (index_id index_subcost index_selectivity)
|
||||
* (a fixnum, a fixnum, and a flonum respectively).
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* predmig.c--
|
||||
* predmig.c
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.17 1999/02/12 17:24:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.18 1999/02/13 23:16:22 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -269,7 +269,7 @@ xfunc_llel_chains(Stream root, Stream bottom)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_complete_stream --
|
||||
** xfunc_complete_stream
|
||||
** Given a stream composed of join nodes only, make a copy containing the
|
||||
** join nodes along with the associated restriction nodes.
|
||||
*/
|
||||
@@ -390,7 +390,7 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_form_groups --
|
||||
** xfunc_form_groups
|
||||
** A group is a pair of stream nodes a,b such that a is constrained to
|
||||
** precede b (for instance if a and b are both joins), but rank(a) > rank(b).
|
||||
** In such a situation, Monma and Sidney prove that no clauses should end
|
||||
@@ -490,7 +490,7 @@ xfunc_form_groups(Query *queryInfo, Stream root, Stream bottom)
|
||||
/* ------------------- UTILITY FUNCTIONS ------------------------- */
|
||||
|
||||
/*
|
||||
** xfunc_free_stream --
|
||||
** xfunc_free_stream
|
||||
** walk down a stream and pfree it
|
||||
*/
|
||||
static void
|
||||
@@ -623,7 +623,7 @@ xfunc_num_relids(Stream node)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_get_downjoin --
|
||||
** xfunc_get_downjoin
|
||||
** Given a stream node, find the next lowest node which points to a
|
||||
** join predicate or a scan node.
|
||||
*/
|
||||
@@ -642,7 +642,7 @@ xfunc_get_downjoin(Stream node)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_get_upjoin --
|
||||
** xfunc_get_upjoin
|
||||
** same as above, but upwards.
|
||||
*/
|
||||
static StreamPtr
|
||||
@@ -660,7 +660,7 @@ xfunc_get_upjoin(Stream node)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_stream_qsort --
|
||||
** xfunc_stream_qsort
|
||||
** Given a stream, sort by group rank the elements in the stream from the
|
||||
** node "bottom" up. DESTRUCTIVELY MODIFIES STREAM! Returns new root.
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* prune.c--
|
||||
* prune.c
|
||||
* Routines to prune redundant paths and relations
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.30 1999/02/12 17:24:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.31 1999/02/13 23:16:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -27,9 +27,9 @@
|
||||
static List *prune_joinrel(RelOptInfo *rel, List *other_rels);
|
||||
|
||||
/*
|
||||
* prune-joinrels--
|
||||
* prune_joinrels
|
||||
* Removes any redundant relation entries from a list of rel nodes
|
||||
* 'rel-list'. Obviously, the first relation can't be a duplicate.
|
||||
* 'rel_list'. Obviously, the first relation can't be a duplicate.
|
||||
*
|
||||
* Returns the resulting list.
|
||||
*
|
||||
@@ -48,8 +48,8 @@ prune_joinrels(List *rel_list)
|
||||
}
|
||||
|
||||
/*
|
||||
* prune-joinrel--
|
||||
* Prunes those relations from 'other-rels' that are redundant with
|
||||
* prune_joinrel
|
||||
* Prunes those relations from 'other_rels' that are redundant with
|
||||
* 'rel'. A relation is redundant if it is built up of the same
|
||||
* relations as 'rel'. Paths for the redundant relation are merged into
|
||||
* the pathlist of 'rel'.
|
||||
@@ -83,8 +83,8 @@ prune_joinrel(RelOptInfo *rel, List *other_rels)
|
||||
}
|
||||
|
||||
/*
|
||||
* rels-set-cheapest
|
||||
* For each relation entry in 'rel-list' (which corresponds to a join
|
||||
* rels_set_cheapest
|
||||
* For each relation entry in 'rel_list' (which corresponds to a join
|
||||
* relation), set pointers to the cheapest path
|
||||
*/
|
||||
void
|
||||
@@ -108,12 +108,12 @@ rels_set_cheapest(List *rel_list)
|
||||
|
||||
|
||||
/*
|
||||
* merge-joinrels--
|
||||
* merge_joinrels
|
||||
* Given two lists of rel nodes that are already
|
||||
* pruned, merge them into one pruned rel node list
|
||||
*
|
||||
* 'rel-list1' and
|
||||
* 'rel-list2' are the rel node lists
|
||||
* 'rel_list1' and
|
||||
* 'rel_list2' are the rel node lists
|
||||
*
|
||||
* Returns one pruned rel node list
|
||||
*/
|
||||
@@ -132,7 +132,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
|
||||
}
|
||||
|
||||
/*
|
||||
* prune_oldrels--
|
||||
* prune_oldrels
|
||||
* If all the joininfo's in a rel node are inactive,
|
||||
* that means that this node has been joined into
|
||||
* other nodes in all possible ways, therefore
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* xfunc.c--
|
||||
* xfunc.c
|
||||
* Utility routines to handle expensive function optimization.
|
||||
* Includes xfunc_trypullup(), which attempts early pullup of predicates
|
||||
* to allow for maximal pruning.
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.27 1999/02/12 17:24:50 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.28 1999/02/13 23:16:24 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -49,7 +49,7 @@ static int xfunc_card_unreferenced(Query *queryInfo,
|
||||
*/
|
||||
|
||||
/*
|
||||
** xfunc_trypullup --
|
||||
** xfunc_trypullup
|
||||
** Preliminary pullup of predicates, to allow for maximal pruning.
|
||||
** Given a relation, check each of its paths and see if you can
|
||||
** pullup clauses from its inner and outer.
|
||||
@@ -127,7 +127,7 @@ xfunc_trypullup(RelOptInfo rel)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_shouldpull --
|
||||
** 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 pathrestrictinfo. Secondary hash and sort clauses are
|
||||
@@ -144,7 +144,7 @@ xfunc_shouldpull(Query *queryInfo,
|
||||
Path childpath,
|
||||
JoinPath parentpath,
|
||||
int whichchild,
|
||||
RestrictInfo * maxcinfopt) /* Out: pointer to clause
|
||||
RestrictInfo *maxcinfopt) /* Out: pointer to clause
|
||||
* to pullup */
|
||||
{
|
||||
LispValue clauselist,
|
||||
@@ -250,7 +250,7 @@ xfunc_shouldpull(Query *queryInfo,
|
||||
|
||||
|
||||
/*
|
||||
** xfunc_pullup --
|
||||
** 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 RelOptInfo just for the childpath,
|
||||
@@ -386,7 +386,7 @@ LispValue clause;
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_join_expense --
|
||||
** xfunc_join_expense
|
||||
** Find global expense of a join clause
|
||||
*/
|
||||
Cost
|
||||
@@ -457,7 +457,7 @@ xfunc_local_expense(LispValue clause)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_func_expense --
|
||||
** xfunc_func_expense
|
||||
** given a Func or Oper and its args, find its expense.
|
||||
** Note: in Stonebraker's SIGMOD '91 paper, he uses a more complicated metric
|
||||
** than the one here. We can ignore the expected number of tuples for
|
||||
@@ -581,7 +581,7 @@ xfunc_func_expense(LispValue node, LispValue args)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_width --
|
||||
** xfunc_width
|
||||
** recursively find the width of a expression
|
||||
*/
|
||||
|
||||
@@ -1071,7 +1071,7 @@ xfunc_total_path_cost(JoinPath pathnode)
|
||||
|
||||
|
||||
/*
|
||||
** xfunc_expense_per_tuple --
|
||||
** xfunc_expense_per_tuple
|
||||
** return the expense of the join *per-tuple* of the input relation.
|
||||
** The cost model here is that a join costs
|
||||
** k*card(outer)*card(inner) + l*card(outer) + m*card(inner) + n
|
||||
@@ -1124,7 +1124,7 @@ xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_fixvars --
|
||||
** xfunc_fixvars
|
||||
** After pulling up a clause, we must walk its expression tree, fixing Var
|
||||
** 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
|
||||
@@ -1154,7 +1154,7 @@ xfunc_fixvars(LispValue clause, /* clause being pulled up */
|
||||
* have to add it. *
|
||||
*
|
||||
*/
|
||||
add_tl_element(rel, (Var) clause);
|
||||
add_var_to_tlist(rel, (Var) clause);
|
||||
tle = tlistentry_member((Var) clause, get_targetlist(rel));
|
||||
}
|
||||
set_varno(((Var) clause), varno);
|
||||
@@ -1223,7 +1223,7 @@ xfunc_clause_compare(void *arg1, void *arg2)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_disjunct_sort --
|
||||
** xfunc_disjunct_sort
|
||||
** given a list of clauses, for each clause sort the disjuncts by cost
|
||||
** (this assumes the predicates have been converted to Conjunctive NF)
|
||||
** Modifies the clause list!
|
||||
@@ -1287,7 +1287,7 @@ xfunc_disjunct_compare(Query *queryInfo, void *arg1, void *arg2)
|
||||
|
||||
/* ------------------------ UTILITY FUNCTIONS ------------------------------- */
|
||||
/*
|
||||
** xfunc_func_width --
|
||||
** xfunc_func_width
|
||||
** Given a function OID and operands, find the width of the return value.
|
||||
*/
|
||||
int
|
||||
@@ -1349,7 +1349,7 @@ exit:
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_tuple_width --
|
||||
** xfunc_tuple_width
|
||||
** Return the sum of the lengths of all the attributes of a given relation
|
||||
*/
|
||||
int
|
||||
@@ -1371,7 +1371,7 @@ xfunc_tuple_width(Relation rd)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_num_join_clauses --
|
||||
** xfunc_num_join_clauses
|
||||
** Find the number of join clauses associated with this join path
|
||||
*/
|
||||
int
|
||||
@@ -1388,7 +1388,7 @@ xfunc_num_join_clauses(JoinPath path)
|
||||
}
|
||||
|
||||
/*
|
||||
** xfunc_LispRemove --
|
||||
** xfunc_LispRemove
|
||||
** Just like LispRemove, but it whines if the item to be removed ain't there
|
||||
*/
|
||||
LispValue
|
||||
@@ -1419,7 +1419,7 @@ do { \
|
||||
} while(0)
|
||||
|
||||
/*
|
||||
** xfunc_copyrel --
|
||||
** xfunc_copyrel
|
||||
** Just like _copyRel, but doesn't copy the paths
|
||||
*/
|
||||
bool
|
||||
|
||||
Reference in New Issue
Block a user