mirror of
https://github.com/postgres/postgres.git
synced 2025-11-15 03:41:20 +03:00
MergeSort was sometimes called mergejoin and was confusing. Now
it is now only mergejoin.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.22 1998/07/18 04:22:31 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.23 1998/08/04 16:44:04 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ bool _enable_indexscan_ = true;
|
||||
bool _enable_sort_ = true;
|
||||
bool _enable_hash_ = true;
|
||||
bool _enable_nestloop_ = true;
|
||||
bool _enable_mergesort_ = true;
|
||||
bool _enable_mergejoin_ = true;
|
||||
bool _enable_hashjoin_ = true;
|
||||
|
||||
Cost _cpu_page_wight_ = _CPU_PAGE_WEIGHT_;
|
||||
@@ -259,7 +259,7 @@ cost_nestloop(Cost outercost,
|
||||
}
|
||||
|
||||
/*
|
||||
* cost_mergesort--
|
||||
* 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
|
||||
@@ -273,7 +273,7 @@ cost_nestloop(Cost outercost,
|
||||
*
|
||||
*/
|
||||
Cost
|
||||
cost_mergesort(Cost outercost,
|
||||
cost_mergejoin(Cost outercost,
|
||||
Cost innercost,
|
||||
List *outersortkeys,
|
||||
List *innersortkeys,
|
||||
@@ -284,7 +284,7 @@ cost_mergesort(Cost outercost,
|
||||
{
|
||||
Cost temp = 0;
|
||||
|
||||
if (!_enable_mergesort_)
|
||||
if (!_enable_mergejoin_)
|
||||
temp += _disable_cost_;
|
||||
|
||||
temp += outercost;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.24 1998/08/04 00:42:08 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.25 1998/08/04 16:44:06 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1251,7 +1251,7 @@ index_innerjoin(Query *root, RelOptInfo *rel, List *clausegroup_list,
|
||||
*
|
||||
* 'rel' is the relation for which 'index' is defined
|
||||
* 'clausegroup-list' is the list of clause groups (lists of clauseinfo
|
||||
* nodes) grouped by mergesortorder
|
||||
* nodes) grouped by mergejoinorder
|
||||
* 'join' is a flag indicating whether or not the clauses are join
|
||||
* clauses
|
||||
*
|
||||
@@ -1284,7 +1284,7 @@ create_index_paths(Query *root,
|
||||
clauseinfo = (CInfo *) lfirst(j);
|
||||
if (!(join_clause_p((Node *) clauseinfo->clause) &&
|
||||
equal_path_merge_ordering(index->ordering,
|
||||
clauseinfo->mergesortorder)))
|
||||
clauseinfo->mergejoinorder)))
|
||||
temp = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.7 1998/07/18 04:22:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.8 1998/08/04 16:44:07 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "optimizer/pathnode.h"
|
||||
#include "optimizer/keys.h"
|
||||
#include "optimizer/cost.h" /* for _enable_{hashjoin,
|
||||
* _enable_mergesort} */
|
||||
* _enable_mergejoin} */
|
||||
|
||||
static Path *best_innerjoin(List *join_paths, List *outer_relid);
|
||||
static List *
|
||||
@@ -98,7 +98,7 @@ find_all_join_paths(Query *root, List *joinrels)
|
||||
|
||||
bestinnerjoin = best_innerjoin(innerrel->innerjoin,
|
||||
outerrel->relids);
|
||||
if (_enable_mergesort_)
|
||||
if (_enable_mergejoin_)
|
||||
{
|
||||
mergeinfo_list =
|
||||
group_clauses_by_order(joinrel->clauseinfo,
|
||||
@@ -116,7 +116,7 @@ find_all_join_paths(Query *root, List *joinrels)
|
||||
joinrel->relids = intAppend(outerrelids, innerrelids);
|
||||
|
||||
/*
|
||||
* 1. Consider mergesort paths where both relations must be
|
||||
* 1. Consider mergejoin paths where both relations must be
|
||||
* explicitly sorted.
|
||||
*/
|
||||
pathlist = sort_inner_and_outer(joinrel, outerrel,
|
||||
@@ -125,7 +125,7 @@ find_all_join_paths(Query *root, List *joinrels)
|
||||
/*
|
||||
* 2. Consider paths where the outer relation need not be
|
||||
* explicitly sorted. This may include either nestloops and
|
||||
* mergesorts where the outer path is already ordered.
|
||||
* mergejoins where the outer path is already ordered.
|
||||
*/
|
||||
pathlist =
|
||||
add_pathlist(joinrel, pathlist,
|
||||
@@ -139,7 +139,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 mergesorts
|
||||
* explicitly sorted. This may include nestloops and mergejoins
|
||||
* the actual nestloop nodes were constructed in
|
||||
* (match-unsorted-outer).
|
||||
*/
|
||||
@@ -226,16 +226,16 @@ best_innerjoin(List *join_paths, List *outer_relids)
|
||||
|
||||
/*
|
||||
* sort-inner-and-outer--
|
||||
* Create mergesort join paths by explicitly sorting both the outer and
|
||||
* 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(mergesortable)
|
||||
* 'mergeinfo-list' is a list of nodes containing info on(mergejoinable)
|
||||
* clauses for joining the relations
|
||||
*
|
||||
* Returns a list of mergesort paths.
|
||||
* Returns a list of mergejoin paths.
|
||||
*/
|
||||
static List *
|
||||
sort_inner_and_outer(RelOptInfo *joinrel,
|
||||
@@ -270,7 +270,7 @@ sort_inner_and_outer(RelOptInfo *joinrel,
|
||||
xmergeinfo->jmethod.clauses);
|
||||
|
||||
temp_node =
|
||||
create_mergesort_path(joinrel,
|
||||
create_mergejoin_path(joinrel,
|
||||
outerrel->size,
|
||||
innerrel->size,
|
||||
outerrel->width,
|
||||
@@ -292,12 +292,12 @@ sort_inner_and_outer(RelOptInfo *joinrel,
|
||||
* match-unsorted-outer--
|
||||
* Creates possible join paths for processing a single join relation
|
||||
* 'joinrel' by employing either iterative substitution or
|
||||
* mergesorting on each of its possible outer paths(assuming that the
|
||||
* mergejoining on each of its possible outer paths(assuming that the
|
||||
* outer relation need not be explicitly sorted).
|
||||
*
|
||||
* 1. The inner path is the cheapest available inner path.
|
||||
* 2. Mergesort wherever possible. Mergesorts are considered if there
|
||||
* are mergesortable join clauses between the outer and inner join
|
||||
* 2. Mergejoin wherever possible. Mergejoin are considered if there
|
||||
* are mergejoinable join clauses between the outer and inner join
|
||||
* relations such that the outer path is keyed on the variables
|
||||
* appearing in the clauses. The corresponding inner merge path is
|
||||
* either a path whose keys match those of the outer path(if such a
|
||||
@@ -310,7 +310,7 @@ sort_inner_and_outer(RelOptInfo *joinrel,
|
||||
* '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 mergesortable
|
||||
* 'mergeinfo-list' is a list of nodes containing info on mergejoinable
|
||||
* clauses
|
||||
*
|
||||
* Returns a list of possible join path nodes.
|
||||
@@ -424,7 +424,7 @@ match_unsorted_outer(RelOptInfo *joinrel,
|
||||
mergeinnerpath = cheapest_inner;
|
||||
|
||||
temp_node =
|
||||
lcons(create_mergesort_path(joinrel,
|
||||
lcons(create_mergejoin_path(joinrel,
|
||||
outerrel->size,
|
||||
innerrel->size,
|
||||
outerrel->width,
|
||||
@@ -463,7 +463,7 @@ match_unsorted_outer(RelOptInfo *joinrel,
|
||||
* '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 mergesortable
|
||||
* 'mergeinfo-list' is a list of nodes containing info on mergejoinable
|
||||
* clauses
|
||||
*
|
||||
* Returns a list of possible merge paths.
|
||||
@@ -542,7 +542,7 @@ match_unsorted_inner(RelOptInfo *joinrel,
|
||||
clauses);
|
||||
|
||||
temp_node =
|
||||
lcons(create_mergesort_path(joinrel,
|
||||
lcons(create_mergejoin_path(joinrel,
|
||||
outerrel->size,
|
||||
innerrel->size,
|
||||
outerrel->width,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.11 1998/07/18 04:22:33 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.12 1998/08/04 16:44:08 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -360,8 +360,8 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
|
||||
joininfo->otherrels;
|
||||
other_joininfo->jinfoclauseinfo =
|
||||
joininfo->jinfoclauseinfo;
|
||||
other_joininfo->mergesortable =
|
||||
joininfo->mergesortable;
|
||||
other_joininfo->mergejoinable =
|
||||
joininfo->mergejoinable;
|
||||
other_joininfo->hashjoinable =
|
||||
joininfo->hashjoinable;
|
||||
other_joininfo->inactive = false;
|
||||
@@ -415,7 +415,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
||||
List *other_rels = joininfo->otherrels;
|
||||
List *clause_info = joininfo->jinfoclauseinfo;
|
||||
bool mergesortable = joininfo->mergesortable;
|
||||
bool mergejoinable = joininfo->mergejoinable;
|
||||
bool hashjoinable = joininfo->hashjoinable;
|
||||
|
||||
foreach(xrelid, other_rels)
|
||||
@@ -428,7 +428,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
|
||||
new_joininfo->otherrels = joinrel->relids;
|
||||
new_joininfo->jinfoclauseinfo = clause_info;
|
||||
new_joininfo->mergesortable = mergesortable;
|
||||
new_joininfo->mergejoinable = mergejoinable;
|
||||
new_joininfo->hashjoinable = hashjoinable;
|
||||
new_joininfo->inactive = false;
|
||||
rel->joininfo =
|
||||
@@ -457,7 +457,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
||||
|
||||
new_joininfo->otherrels = new_relids;
|
||||
new_joininfo->jinfoclauseinfo = clause_info;
|
||||
new_joininfo->mergesortable = mergesortable;
|
||||
new_joininfo->mergejoinable = mergejoinable;
|
||||
new_joininfo->hashjoinable = hashjoinable;
|
||||
new_joininfo->inactive = false;
|
||||
joinrel->joininfo =
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.6 1998/08/04 00:42:09 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.7 1998/08/04 16:44:10 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
/*
|
||||
* group-clauses-by-order--
|
||||
* If a join clause node in 'clauseinfo-list' is mergesortable, store
|
||||
* If a join clause node in 'clauseinfo-list' is mergejoinable, store
|
||||
* it within a mergeinfo node containing other clause nodes with the same
|
||||
* mergesort ordering.
|
||||
* mergejoin ordering.
|
||||
*
|
||||
* 'clauseinfo-list' is the list of clauseinfo nodes
|
||||
* 'inner-relid' is the relid of the inner join relation
|
||||
@@ -43,7 +43,7 @@ group_clauses_by_order(List *clauseinfo_list,
|
||||
foreach(xclauseinfo, clauseinfo_list)
|
||||
{
|
||||
CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
|
||||
MergeOrder *merge_ordering = clauseinfo->mergesortorder;
|
||||
MergeOrder *merge_ordering = clauseinfo->mergejoinorder;
|
||||
|
||||
if (merge_ordering)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.16 1998/07/18 04:22:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.17 1998/08/04 16:44:11 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -1022,7 +1022,7 @@ xfunc_total_path_cost(JoinPath pathnode)
|
||||
{
|
||||
MergePath mrgnode = (MergePath) pathnode;
|
||||
|
||||
cost += cost_mergesort(get_path_cost((Path) get_outerjoinpath(mrgnode)),
|
||||
cost += cost_mergejoin(get_path_cost((Path) get_outerjoinpath(mrgnode)),
|
||||
get_path_cost((Path) get_innerjoinpath(mrgnode)),
|
||||
get_outersortkeys(mrgnode),
|
||||
get_innersortkeys(mrgnode),
|
||||
|
||||
Reference in New Issue
Block a user