MergeSort was sometimes called mergejoin and was confusing. Now
it is now only mergejoin.
This commit is contained in:
parent
7db9ea5c1e
commit
d9be0ff432
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.22 1998/08/04 15:00:26 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.23 1998/08/04 16:43:54 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -17,6 +17,7 @@
|
||||
#include <postgres.h>
|
||||
|
||||
#include <nodes/plannodes.h>
|
||||
#include <nodes/print.h>
|
||||
#include <tcop/tcopprot.h>
|
||||
#include <lib/stringinfo.h>
|
||||
#include <commands/explain.h>
|
||||
@ -81,10 +82,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
|
||||
es->rtable = query->rtable;
|
||||
|
||||
if (es->printNodes)
|
||||
{
|
||||
pprint(plan); /* display in postmaster log file */
|
||||
s = nodeToString(plan);
|
||||
}
|
||||
|
||||
if (es->printCost)
|
||||
{
|
||||
@ -108,6 +106,9 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
|
||||
elog(NOTICE, "%.*s", ELOG_MAXLEN - 64, s);
|
||||
len -= ELOG_MAXLEN - 64;
|
||||
}
|
||||
if (es->printNodes)
|
||||
pprint(plan); /* display in postmaster log file */
|
||||
|
||||
pfree(es);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.45 1998/08/01 22:12:05 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.46 1998/08/04 16:43:56 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -335,7 +335,7 @@ _copyMergeJoin(MergeJoin *from)
|
||||
*/
|
||||
Node_Copy(from, newnode, mergeclauses);
|
||||
|
||||
newnode->mergesortop = from->mergesortop;
|
||||
newnode->mergejoinop = from->mergejoinop;
|
||||
|
||||
newnode->mergerightorder = (Oid *) palloc(sizeof(Oid) * 2);
|
||||
newnode->mergerightorder[0] = from->mergerightorder[0];
|
||||
@ -1334,7 +1334,7 @@ _copyCInfo(CInfo *from)
|
||||
newnode->notclause = from->notclause;
|
||||
|
||||
Node_Copy(from, newnode, indexids);
|
||||
Node_Copy(from, newnode, mergesortorder);
|
||||
Node_Copy(from, newnode, mergejoinorder);
|
||||
newnode->hashjoinoperator = from->hashjoinoperator;
|
||||
newnode->cinfojoinid = listCopy(from->cinfojoinid);
|
||||
|
||||
@ -1424,7 +1424,7 @@ _copyJInfo(JInfo *from)
|
||||
newnode->otherrels = listCopy(from->otherrels);
|
||||
Node_Copy(from, newnode, jinfoclauseinfo);
|
||||
|
||||
newnode->mergesortable = from->mergesortable;
|
||||
newnode->mergejoinable = from->mergejoinable;
|
||||
newnode->hashjoinable = from->hashjoinable;
|
||||
newnode->inactive = from->inactive;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.17 1998/08/01 22:12:07 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.18 1998/08/04 16:43:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -293,7 +293,7 @@ _equalCInfo(CInfo *a, CInfo *b)
|
||||
if (a->notclause != b->notclause)
|
||||
return (false);
|
||||
#ifdef EqualMergeOrderExists
|
||||
if (!EqualMergeOrder(a->mergesortorder, b->mergesortorder))
|
||||
if (!EqualMergeOrder(a->mergejoinorder, b->mergejoinorder))
|
||||
return (false);
|
||||
#endif
|
||||
if (a->hashjoinoperator != b->hashjoinoperator)
|
||||
@ -538,7 +538,7 @@ _equalJInfo(JInfo *a, JInfo *b)
|
||||
return (false);
|
||||
if (!equal((a->jinfoclauseinfo), (b->jinfoclauseinfo)))
|
||||
return (false);
|
||||
if (a->mergesortable != b->mergesortable)
|
||||
if (a->mergejoinable != b->mergejoinable)
|
||||
return (false);
|
||||
if (a->hashjoinable != b->hashjoinable)
|
||||
return (false);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.42 1998/08/01 22:12:08 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.43 1998/08/04 16:43:59 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||
@ -403,7 +403,7 @@ _outMergeJoin(StringInfo str, MergeJoin *node)
|
||||
appendStringInfo(str, " :mergeclauses ");
|
||||
_outNode(str, node->mergeclauses);
|
||||
|
||||
sprintf(buf, " :mergesortop %u ", node->mergesortop);
|
||||
sprintf(buf, " :mergejoinop %u ", node->mergejoinop);
|
||||
appendStringInfo(str, buf);
|
||||
|
||||
sprintf(buf, " :mergerightorder %u ", node->mergerightorder[0]);
|
||||
@ -1373,8 +1373,8 @@ _outCInfo(StringInfo str, CInfo *node)
|
||||
appendStringInfo(str, " :indexids ");
|
||||
_outNode(str, node->indexids);
|
||||
|
||||
appendStringInfo(str, " :mergesortorder ");
|
||||
_outNode(str, node->mergesortorder);
|
||||
appendStringInfo(str, " :mergejoinorder ");
|
||||
_outNode(str, node->mergejoinorder);
|
||||
|
||||
sprintf(buf, " :hashjoinoperator %u ", node->hashjoinoperator);
|
||||
appendStringInfo(str, buf);
|
||||
@ -1434,8 +1434,8 @@ _outJInfo(StringInfo str, JInfo *node)
|
||||
appendStringInfo(str, " :jinfoclauseinfo ");
|
||||
_outNode(str, node->jinfoclauseinfo);
|
||||
|
||||
appendStringInfo(str, " :mergesortable ");
|
||||
appendStringInfo(str, node->mergesortable ? "true" : "false");
|
||||
appendStringInfo(str, " :mergejoinable ");
|
||||
appendStringInfo(str, node->mergejoinable ? "true" : "false");
|
||||
appendStringInfo(str, " :hashjoinable ");
|
||||
appendStringInfo(str, node->hashjoinable ? "true" : "false");
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.34 1998/08/01 22:12:09 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.35 1998/08/04 16:44:00 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Most of the read functions for plan nodes are tested. (In fact, they
|
||||
@ -407,9 +407,9 @@ _readMergeJoin()
|
||||
token = lsptok(NULL, &length); /* eat :mergeclauses */
|
||||
local_node->mergeclauses = nodeRead(true); /* now read it */
|
||||
|
||||
token = lsptok(NULL, &length); /* eat :mergesortop */
|
||||
token = lsptok(NULL, &length); /* get mergesortop */
|
||||
local_node->mergesortop = atol(token);
|
||||
token = lsptok(NULL, &length); /* eat :mergejoinop */
|
||||
token = lsptok(NULL, &length); /* get mergejoinop */
|
||||
local_node->mergejoinop = atol(token);
|
||||
|
||||
return (local_node);
|
||||
}
|
||||
@ -1794,8 +1794,8 @@ _readCInfo()
|
||||
token = lsptok(NULL, &length); /* get :indexids */
|
||||
local_node->indexids = nodeRead(true); /* now read it */
|
||||
|
||||
token = lsptok(NULL, &length); /* get :mergesortorder */
|
||||
local_node->mergesortorder = (MergeOrder *) nodeRead(true);
|
||||
token = lsptok(NULL, &length); /* get :mergejoinorder */
|
||||
local_node->mergejoinorder = (MergeOrder *) nodeRead(true);
|
||||
|
||||
token = lsptok(NULL, &length); /* get :hashjoinoperator */
|
||||
token = lsptok(NULL, &length); /* now read it */
|
||||
@ -1880,12 +1880,12 @@ _readJInfo()
|
||||
token = lsptok(NULL, &length); /* get :jinfoclauseinfo */
|
||||
local_node->jinfoclauseinfo = nodeRead(true); /* now read it */
|
||||
|
||||
token = lsptok(NULL, &length); /* get :mergesortable */
|
||||
token = lsptok(NULL, &length); /* get :mergejoinable */
|
||||
|
||||
if (!strncmp(token, "true", 4))
|
||||
local_node->mergesortable = true;
|
||||
local_node->mergejoinable = true;
|
||||
else
|
||||
local_node->mergesortable = false;
|
||||
local_node->mergejoinable = false;
|
||||
|
||||
token = lsptok(NULL, &length); /* get :hashjoinable */
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: geqo_eval.c,v 1.20 1998/07/18 04:22:27 momjian Exp $
|
||||
* $Id: geqo_eval.c,v 1.21 1998/08/04 16:44:02 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -422,8 +422,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;
|
||||
@ -509,7 +509,7 @@ geqo_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)
|
||||
@ -541,7 +541,7 @@ geqo_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 =
|
||||
@ -570,7 +570,7 @@ geqo_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/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),
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.29 1998/07/18 04:22:36 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.30 1998/08/04 16:44:12 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -79,7 +79,7 @@ make_hashjoin(List *tlist, List *qpqual,
|
||||
List *hashclauses, Plan *lefttree, Plan *righttree);
|
||||
static Hash *make_hash(List *tlist, Var *hashkey, Plan *lefttree);
|
||||
static MergeJoin *
|
||||
make_mergesort(List *tlist, List *qpqual,
|
||||
make_mergejoin(List *tlist, List *qpqual,
|
||||
List *mergeclauses, Oid opcode, Oid *rightorder,
|
||||
Oid *leftorder, Plan *righttree, Plan *lefttree);
|
||||
static Material *
|
||||
@ -584,7 +584,7 @@ create_mergejoin_node(MergePath *best_path,
|
||||
inner_node = (Plan *) sorted_inner_node;
|
||||
}
|
||||
|
||||
join_node = make_mergesort(tlist,
|
||||
join_node = make_mergejoin(tlist,
|
||||
qpqual,
|
||||
mergeclauses,
|
||||
opcode,
|
||||
@ -1038,7 +1038,7 @@ make_hash(List *tlist, Var *hashkey, Plan *lefttree)
|
||||
}
|
||||
|
||||
static MergeJoin *
|
||||
make_mergesort(List *tlist,
|
||||
make_mergejoin(List *tlist,
|
||||
List *qpqual,
|
||||
List *mergeclauses,
|
||||
Oid opcode,
|
||||
@ -1058,7 +1058,7 @@ make_mergesort(List *tlist,
|
||||
plan->lefttree = lefttree;
|
||||
plan->righttree = righttree;
|
||||
node->mergeclauses = mergeclauses;
|
||||
node->mergesortop = opcode;
|
||||
node->mergejoinop = opcode;
|
||||
node->mergerightorder = rightorder;
|
||||
node->mergeleftorder = leftorder;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.13 1998/07/18 04:22:37 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.14 1998/08/04 16:44:14 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -41,7 +41,7 @@ add_join_clause_info_to_rels(Query *root, CInfo *clauseinfo,
|
||||
List *join_relids);
|
||||
static void add_vars_to_rels(Query *root, List *vars, List *join_relids);
|
||||
|
||||
static MergeOrder *mergesortop(Expr *clause);
|
||||
static MergeOrder *mergejoinop(Expr *clause);
|
||||
static Oid hashjoinop(Expr *clause);
|
||||
|
||||
|
||||
@ -180,7 +180,7 @@ add_clause_to_rels(Query *root, List *clause)
|
||||
clauseinfo->notclause = contains_not((Node *) clause);
|
||||
clauseinfo->selectivity = 0;
|
||||
clauseinfo->indexids = NIL;
|
||||
clauseinfo->mergesortorder = (MergeOrder *) NULL;
|
||||
clauseinfo->mergejoinorder = (MergeOrder *) NULL;
|
||||
clauseinfo->hashjoinoperator = (Oid) 0;
|
||||
|
||||
|
||||
@ -324,8 +324,8 @@ add_vars_to_rels(Query *root, List *vars, List *join_relids)
|
||||
|
||||
/*
|
||||
* initialize-join-clause-info--
|
||||
* Set the MergeSortable or HashJoinable field for every joininfo node
|
||||
* (within a rel node) and the MergeSortOrder or HashJoinOp field for
|
||||
* Set the MergeJoinable or HashJoinable field for every joininfo node
|
||||
* (within a rel node) and the MergeJoinOrder or HashJoinOp field for
|
||||
* each clauseinfo node(within a joininfo node) for all relations in a
|
||||
* query.
|
||||
*
|
||||
@ -357,15 +357,15 @@ initialize_join_clause_info(List *rel_list)
|
||||
MergeOrder *sortop = (MergeOrder *) NULL;
|
||||
Oid hashop = (Oid) NULL;
|
||||
|
||||
if (_enable_mergesort_)
|
||||
sortop = mergesortop(clause);
|
||||
if (_enable_mergejoin_)
|
||||
sortop = mergejoinop(clause);
|
||||
if (_enable_hashjoin_)
|
||||
hashop = hashjoinop(clause);
|
||||
|
||||
if (sortop)
|
||||
{
|
||||
clauseinfo->mergesortorder = sortop;
|
||||
joininfo->mergesortable = true;
|
||||
clauseinfo->mergejoinorder = sortop;
|
||||
joininfo->mergejoinable = true;
|
||||
}
|
||||
if (hashop)
|
||||
{
|
||||
@ -379,19 +379,19 @@ initialize_join_clause_info(List *rel_list)
|
||||
}
|
||||
|
||||
/*
|
||||
* mergesortop--
|
||||
* Returns the mergesort operator of an operator iff 'clause' is
|
||||
* mergesortable, i.e., both operands are single vars and the operator is
|
||||
* a mergesortable operator.
|
||||
* mergejoinop--
|
||||
* Returns the mergejoin operator of an operator iff 'clause' is
|
||||
* mergejoinable, i.e., both operands are single vars and the operator is
|
||||
* a mergejoinable operator.
|
||||
*/
|
||||
static MergeOrder *
|
||||
mergesortop(Expr *clause)
|
||||
mergejoinop(Expr *clause)
|
||||
{
|
||||
Oid leftOp,
|
||||
rightOp;
|
||||
bool sortable;
|
||||
|
||||
sortable = op_mergesortable(((Oper *) clause->oper)->opno,
|
||||
sortable = op_mergejoinable(((Oper *) clause->oper)->opno,
|
||||
(get_leftop(clause))->vartype,
|
||||
(get_rightop(clause))->vartype,
|
||||
&leftOp,
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.8 1998/07/18 04:22:40 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.9 1998/08/04 16:44:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -72,7 +72,7 @@ find_joininfo_node(RelOptInfo *this_rel, List *join_relids)
|
||||
joininfo = makeNode(JInfo);
|
||||
joininfo->otherrels = join_relids;
|
||||
joininfo->jinfoclauseinfo = NIL;
|
||||
joininfo->mergesortable = false;
|
||||
joininfo->mergejoinable = false;
|
||||
joininfo->hashjoinable = false;
|
||||
joininfo->inactive = false;
|
||||
this_rel->joininfo = lcons(joininfo, this_rel->joininfo);
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.9 1998/07/18 04:22:41 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.10 1998/08/04 16:44:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -462,8 +462,8 @@ create_nestloop_path(RelOptInfo *joinrel,
|
||||
}
|
||||
|
||||
/*
|
||||
* create_mergesort_path--
|
||||
* Creates a pathnode corresponding to a mergesort join between
|
||||
* create_mergejoin_path--
|
||||
* Creates a pathnode corresponding to a mergejoin join between
|
||||
* two relations
|
||||
*
|
||||
* 'joinrel' is the join relation
|
||||
@ -481,7 +481,7 @@ create_nestloop_path(RelOptInfo *joinrel,
|
||||
*
|
||||
*/
|
||||
MergePath *
|
||||
create_mergesort_path(RelOptInfo *joinrel,
|
||||
create_mergejoin_path(RelOptInfo *joinrel,
|
||||
int outersize,
|
||||
int innersize,
|
||||
int outerwidth,
|
||||
@ -509,7 +509,7 @@ create_mergesort_path(RelOptInfo *joinrel,
|
||||
pathnode->outersortkeys = outersortkeys;
|
||||
pathnode->innersortkeys = innersortkeys;
|
||||
pathnode->jpath.path.path_cost =
|
||||
cost_mergesort(outer_path->path_cost,
|
||||
cost_mergejoin(outer_path->path_cost,
|
||||
inner_path->path_cost,
|
||||
outersortkeys,
|
||||
innersortkeys,
|
||||
|
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.81 1998/07/26 04:30:46 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.82 1998/08/04 16:44:20 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@ -977,7 +977,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
||||
_enable_nestloop_ = false;
|
||||
break;
|
||||
case 'm': /* mergejoin */
|
||||
_enable_mergesort_ = false;
|
||||
_enable_mergejoin_ = false;
|
||||
break;
|
||||
case 'h': /* hashjoin */
|
||||
_enable_hashjoin_ = false;
|
||||
@ -1339,7 +1339,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
puts("\nPOSTGRES backend interactive interface");
|
||||
puts("$Revision: 1.81 $ $Date: 1998/07/26 04:30:46 $");
|
||||
puts("$Revision: 1.82 $ $Date: 1998/08/04 16:44:20 $");
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
|
8
src/backend/utils/cache/lsyscache.c
vendored
8
src/backend/utils/cache/lsyscache.c
vendored
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.15 1998/07/12 21:29:24 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.16 1998/08/04 16:44:22 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Eventually, the index information should go through here, too.
|
||||
@ -226,14 +226,14 @@ get_opname(Oid opno)
|
||||
}
|
||||
|
||||
/*
|
||||
* op_mergesortable -
|
||||
* op_mergejoinable -
|
||||
*
|
||||
* Returns the left and right sort operators and types corresponding to a
|
||||
* mergesortable operator, or nil if the operator is not mergesortable.
|
||||
* mergejoinable operator, or nil if the operator is not mergejoinable.
|
||||
*
|
||||
*/
|
||||
bool
|
||||
op_mergesortable(Oid opno, Oid ltype, Oid rtype, Oid *leftOp, Oid *rightOp)
|
||||
op_mergejoinable(Oid opno, Oid ltype, Oid rtype, Oid *leftOp, Oid *rightOp)
|
||||
{
|
||||
FormData_pg_operator optup;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: plannodes.h,v 1.16 1998/07/15 14:54:39 momjian Exp $
|
||||
* $Id: plannodes.h,v 1.17 1998/08/04 16:44:24 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -211,7 +211,7 @@ typedef struct MergeJoin
|
||||
{
|
||||
Join join;
|
||||
List *mergeclauses;
|
||||
Oid mergesortop;
|
||||
Oid mergejoinop;
|
||||
Oid *mergerightorder;/* inner sort operator */
|
||||
Oid *mergeleftorder; /* outer sort operator */
|
||||
MergeJoinState *mergestate;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: relation.h,v 1.8 1998/07/18 04:22:45 momjian Exp $
|
||||
* $Id: relation.h,v 1.9 1998/08/04 16:44:26 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -215,8 +215,8 @@ typedef struct CInfo
|
||||
bool notclause;
|
||||
List *indexids;
|
||||
|
||||
/* mergesort only */
|
||||
MergeOrder *mergesortorder;
|
||||
/* mergejoin only */
|
||||
MergeOrder *mergejoinorder;
|
||||
|
||||
/* hashjoin only */
|
||||
Oid hashjoinoperator;
|
||||
@ -247,7 +247,7 @@ typedef struct JInfo
|
||||
NodeTag type;
|
||||
List *otherrels;
|
||||
List *jinfoclauseinfo;
|
||||
bool mergesortable;
|
||||
bool mergejoinable;
|
||||
bool hashjoinable;
|
||||
bool inactive;
|
||||
} JInfo;
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: cost.h,v 1.9 1998/07/18 04:22:46 momjian Exp $
|
||||
* $Id: cost.h,v 1.10 1998/08/04 16:44:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -27,7 +27,7 @@ extern bool _enable_indexscan_;
|
||||
extern bool _enable_sort_;
|
||||
extern bool _enable_hash_;
|
||||
extern bool _enable_nestloop_;
|
||||
extern bool _enable_mergesort_;
|
||||
extern bool _enable_mergejoin_;
|
||||
extern bool _enable_hashjoin_;
|
||||
|
||||
extern Cost cost_seqscan(int relid, int relpages, int reltuples);
|
||||
@ -40,7 +40,7 @@ extern Cost
|
||||
cost_nestloop(Cost outercost, Cost innercost, int outertuples,
|
||||
int innertuples, int outerpages, bool is_indexjoin);
|
||||
extern Cost
|
||||
cost_mergesort(Cost outercost, Cost innercost,
|
||||
cost_mergejoin(Cost outercost, Cost innercost,
|
||||
List *outersortkeys, List *innersortkeys,
|
||||
int outersize, int innersize, int outerwidth, int innerwidth);
|
||||
extern Cost
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pathnode.h,v 1.8 1998/07/18 04:22:51 momjian Exp $
|
||||
* $Id: pathnode.h,v 1.9 1998/08/04 16:44:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -33,7 +33,7 @@ extern JoinPath *
|
||||
create_nestloop_path(RelOptInfo *joinrel, RelOptInfo *outer_rel,
|
||||
Path *outer_path, Path *inner_path, List *keys);
|
||||
extern MergePath *
|
||||
create_mergesort_path(RelOptInfo *joinrel, int outersize,
|
||||
create_mergejoin_path(RelOptInfo *joinrel, int outersize,
|
||||
int innersize, int outerwidth, int innerwidth, Path *outer_path,
|
||||
Path *inner_path, List *keys, MergeOrder *order,
|
||||
List *mergeclauses, List *outersortkeys, List *innersortkeys);
|
||||
|
@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: lsyscache.h,v 1.11 1998/07/12 21:29:40 momjian Exp $
|
||||
* $Id: lsyscache.h,v 1.12 1998/08/04 16:44:31 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -25,7 +25,7 @@ extern int32 get_atttypmod(Oid relid, AttrNumber attnum);
|
||||
extern RegProcedure get_opcode(Oid opid);
|
||||
extern char *get_opname(Oid opid);
|
||||
extern bool
|
||||
op_mergesortable(Oid opid, Oid ltype, Oid rtype,
|
||||
op_mergejoinable(Oid opid, Oid ltype, Oid rtype,
|
||||
Oid *leftOp, Oid *rightOp);
|
||||
extern Oid op_hashjoinable(Oid opid, Oid ltype, Oid rtype);
|
||||
extern Oid get_commutator(Oid opid);
|
||||
|
Loading…
Reference in New Issue
Block a user