mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
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
|
* 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 <postgres.h>
|
||||||
|
|
||||||
#include <nodes/plannodes.h>
|
#include <nodes/plannodes.h>
|
||||||
|
#include <nodes/print.h>
|
||||||
#include <tcop/tcopprot.h>
|
#include <tcop/tcopprot.h>
|
||||||
#include <lib/stringinfo.h>
|
#include <lib/stringinfo.h>
|
||||||
#include <commands/explain.h>
|
#include <commands/explain.h>
|
||||||
@ -81,10 +82,7 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
|
|||||||
es->rtable = query->rtable;
|
es->rtable = query->rtable;
|
||||||
|
|
||||||
if (es->printNodes)
|
if (es->printNodes)
|
||||||
{
|
|
||||||
pprint(plan); /* display in postmaster log file */
|
|
||||||
s = nodeToString(plan);
|
s = nodeToString(plan);
|
||||||
}
|
|
||||||
|
|
||||||
if (es->printCost)
|
if (es->printCost)
|
||||||
{
|
{
|
||||||
@ -108,6 +106,9 @@ ExplainQuery(Query *query, bool verbose, CommandDest dest)
|
|||||||
elog(NOTICE, "%.*s", ELOG_MAXLEN - 64, s);
|
elog(NOTICE, "%.*s", ELOG_MAXLEN - 64, s);
|
||||||
len -= ELOG_MAXLEN - 64;
|
len -= ELOG_MAXLEN - 64;
|
||||||
}
|
}
|
||||||
|
if (es->printNodes)
|
||||||
|
pprint(plan); /* display in postmaster log file */
|
||||||
|
|
||||||
pfree(es);
|
pfree(es);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
Node_Copy(from, newnode, mergeclauses);
|
||||||
|
|
||||||
newnode->mergesortop = from->mergesortop;
|
newnode->mergejoinop = from->mergejoinop;
|
||||||
|
|
||||||
newnode->mergerightorder = (Oid *) palloc(sizeof(Oid) * 2);
|
newnode->mergerightorder = (Oid *) palloc(sizeof(Oid) * 2);
|
||||||
newnode->mergerightorder[0] = from->mergerightorder[0];
|
newnode->mergerightorder[0] = from->mergerightorder[0];
|
||||||
@ -1334,7 +1334,7 @@ _copyCInfo(CInfo *from)
|
|||||||
newnode->notclause = from->notclause;
|
newnode->notclause = from->notclause;
|
||||||
|
|
||||||
Node_Copy(from, newnode, indexids);
|
Node_Copy(from, newnode, indexids);
|
||||||
Node_Copy(from, newnode, mergesortorder);
|
Node_Copy(from, newnode, mergejoinorder);
|
||||||
newnode->hashjoinoperator = from->hashjoinoperator;
|
newnode->hashjoinoperator = from->hashjoinoperator;
|
||||||
newnode->cinfojoinid = listCopy(from->cinfojoinid);
|
newnode->cinfojoinid = listCopy(from->cinfojoinid);
|
||||||
|
|
||||||
@ -1424,7 +1424,7 @@ _copyJInfo(JInfo *from)
|
|||||||
newnode->otherrels = listCopy(from->otherrels);
|
newnode->otherrels = listCopy(from->otherrels);
|
||||||
Node_Copy(from, newnode, jinfoclauseinfo);
|
Node_Copy(from, newnode, jinfoclauseinfo);
|
||||||
|
|
||||||
newnode->mergesortable = from->mergesortable;
|
newnode->mergejoinable = from->mergejoinable;
|
||||||
newnode->hashjoinable = from->hashjoinable;
|
newnode->hashjoinable = from->hashjoinable;
|
||||||
newnode->inactive = from->inactive;
|
newnode->inactive = from->inactive;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
if (a->notclause != b->notclause)
|
||||||
return (false);
|
return (false);
|
||||||
#ifdef EqualMergeOrderExists
|
#ifdef EqualMergeOrderExists
|
||||||
if (!EqualMergeOrder(a->mergesortorder, b->mergesortorder))
|
if (!EqualMergeOrder(a->mergejoinorder, b->mergejoinorder))
|
||||||
return (false);
|
return (false);
|
||||||
#endif
|
#endif
|
||||||
if (a->hashjoinoperator != b->hashjoinoperator)
|
if (a->hashjoinoperator != b->hashjoinoperator)
|
||||||
@ -538,7 +538,7 @@ _equalJInfo(JInfo *a, JInfo *b)
|
|||||||
return (false);
|
return (false);
|
||||||
if (!equal((a->jinfoclauseinfo), (b->jinfoclauseinfo)))
|
if (!equal((a->jinfoclauseinfo), (b->jinfoclauseinfo)))
|
||||||
return (false);
|
return (false);
|
||||||
if (a->mergesortable != b->mergesortable)
|
if (a->mergejoinable != b->mergejoinable)
|
||||||
return (false);
|
return (false);
|
||||||
if (a->hashjoinable != b->hashjoinable)
|
if (a->hashjoinable != b->hashjoinable)
|
||||||
return (false);
|
return (false);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||||
@ -403,7 +403,7 @@ _outMergeJoin(StringInfo str, MergeJoin *node)
|
|||||||
appendStringInfo(str, " :mergeclauses ");
|
appendStringInfo(str, " :mergeclauses ");
|
||||||
_outNode(str, node->mergeclauses);
|
_outNode(str, node->mergeclauses);
|
||||||
|
|
||||||
sprintf(buf, " :mergesortop %u ", node->mergesortop);
|
sprintf(buf, " :mergejoinop %u ", node->mergejoinop);
|
||||||
appendStringInfo(str, buf);
|
appendStringInfo(str, buf);
|
||||||
|
|
||||||
sprintf(buf, " :mergerightorder %u ", node->mergerightorder[0]);
|
sprintf(buf, " :mergerightorder %u ", node->mergerightorder[0]);
|
||||||
@ -1373,8 +1373,8 @@ _outCInfo(StringInfo str, CInfo *node)
|
|||||||
appendStringInfo(str, " :indexids ");
|
appendStringInfo(str, " :indexids ");
|
||||||
_outNode(str, node->indexids);
|
_outNode(str, node->indexids);
|
||||||
|
|
||||||
appendStringInfo(str, " :mergesortorder ");
|
appendStringInfo(str, " :mergejoinorder ");
|
||||||
_outNode(str, node->mergesortorder);
|
_outNode(str, node->mergejoinorder);
|
||||||
|
|
||||||
sprintf(buf, " :hashjoinoperator %u ", node->hashjoinoperator);
|
sprintf(buf, " :hashjoinoperator %u ", node->hashjoinoperator);
|
||||||
appendStringInfo(str, buf);
|
appendStringInfo(str, buf);
|
||||||
@ -1434,8 +1434,8 @@ _outJInfo(StringInfo str, JInfo *node)
|
|||||||
appendStringInfo(str, " :jinfoclauseinfo ");
|
appendStringInfo(str, " :jinfoclauseinfo ");
|
||||||
_outNode(str, node->jinfoclauseinfo);
|
_outNode(str, node->jinfoclauseinfo);
|
||||||
|
|
||||||
appendStringInfo(str, " :mergesortable ");
|
appendStringInfo(str, " :mergejoinable ");
|
||||||
appendStringInfo(str, node->mergesortable ? "true" : "false");
|
appendStringInfo(str, node->mergejoinable ? "true" : "false");
|
||||||
appendStringInfo(str, " :hashjoinable ");
|
appendStringInfo(str, " :hashjoinable ");
|
||||||
appendStringInfo(str, node->hashjoinable ? "true" : "false");
|
appendStringInfo(str, node->hashjoinable ? "true" : "false");
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* Most of the read functions for plan nodes are tested. (In fact, they
|
* Most of the read functions for plan nodes are tested. (In fact, they
|
||||||
@ -407,9 +407,9 @@ _readMergeJoin()
|
|||||||
token = lsptok(NULL, &length); /* eat :mergeclauses */
|
token = lsptok(NULL, &length); /* eat :mergeclauses */
|
||||||
local_node->mergeclauses = nodeRead(true); /* now read it */
|
local_node->mergeclauses = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* eat :mergesortop */
|
token = lsptok(NULL, &length); /* eat :mergejoinop */
|
||||||
token = lsptok(NULL, &length); /* get mergesortop */
|
token = lsptok(NULL, &length); /* get mergejoinop */
|
||||||
local_node->mergesortop = atol(token);
|
local_node->mergejoinop = atol(token);
|
||||||
|
|
||||||
return (local_node);
|
return (local_node);
|
||||||
}
|
}
|
||||||
@ -1794,8 +1794,8 @@ _readCInfo()
|
|||||||
token = lsptok(NULL, &length); /* get :indexids */
|
token = lsptok(NULL, &length); /* get :indexids */
|
||||||
local_node->indexids = nodeRead(true); /* now read it */
|
local_node->indexids = nodeRead(true); /* now read it */
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :mergesortorder */
|
token = lsptok(NULL, &length); /* get :mergejoinorder */
|
||||||
local_node->mergesortorder = (MergeOrder *) nodeRead(true);
|
local_node->mergejoinorder = (MergeOrder *) nodeRead(true);
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :hashjoinoperator */
|
token = lsptok(NULL, &length); /* get :hashjoinoperator */
|
||||||
token = lsptok(NULL, &length); /* now read it */
|
token = lsptok(NULL, &length); /* now read it */
|
||||||
@ -1880,12 +1880,12 @@ _readJInfo()
|
|||||||
token = lsptok(NULL, &length); /* get :jinfoclauseinfo */
|
token = lsptok(NULL, &length); /* get :jinfoclauseinfo */
|
||||||
local_node->jinfoclauseinfo = nodeRead(true); /* now read it */
|
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))
|
if (!strncmp(token, "true", 4))
|
||||||
local_node->mergesortable = true;
|
local_node->mergejoinable = true;
|
||||||
else
|
else
|
||||||
local_node->mergesortable = false;
|
local_node->mergejoinable = false;
|
||||||
|
|
||||||
token = lsptok(NULL, &length); /* get :hashjoinable */
|
token = lsptok(NULL, &length); /* get :hashjoinable */
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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;
|
joininfo->otherrels;
|
||||||
other_joininfo->jinfoclauseinfo =
|
other_joininfo->jinfoclauseinfo =
|
||||||
joininfo->jinfoclauseinfo;
|
joininfo->jinfoclauseinfo;
|
||||||
other_joininfo->mergesortable =
|
other_joininfo->mergejoinable =
|
||||||
joininfo->mergesortable;
|
joininfo->mergejoinable;
|
||||||
other_joininfo->hashjoinable =
|
other_joininfo->hashjoinable =
|
||||||
joininfo->hashjoinable;
|
joininfo->hashjoinable;
|
||||||
other_joininfo->inactive = false;
|
other_joininfo->inactive = false;
|
||||||
@ -509,7 +509,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
|||||||
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
||||||
List *other_rels = joininfo->otherrels;
|
List *other_rels = joininfo->otherrels;
|
||||||
List *clause_info = joininfo->jinfoclauseinfo;
|
List *clause_info = joininfo->jinfoclauseinfo;
|
||||||
bool mergesortable = joininfo->mergesortable;
|
bool mergejoinable = joininfo->mergejoinable;
|
||||||
bool hashjoinable = joininfo->hashjoinable;
|
bool hashjoinable = joininfo->hashjoinable;
|
||||||
|
|
||||||
foreach(xrelid, other_rels)
|
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->otherrels = joinrel->relids;
|
||||||
new_joininfo->jinfoclauseinfo = clause_info;
|
new_joininfo->jinfoclauseinfo = clause_info;
|
||||||
new_joininfo->mergesortable = mergesortable;
|
new_joininfo->mergejoinable = mergejoinable;
|
||||||
new_joininfo->hashjoinable = hashjoinable;
|
new_joininfo->hashjoinable = hashjoinable;
|
||||||
new_joininfo->inactive = false;
|
new_joininfo->inactive = false;
|
||||||
rel->joininfo =
|
rel->joininfo =
|
||||||
@ -570,7 +570,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
|||||||
|
|
||||||
new_joininfo->otherrels = new_relids;
|
new_joininfo->otherrels = new_relids;
|
||||||
new_joininfo->jinfoclauseinfo = clause_info;
|
new_joininfo->jinfoclauseinfo = clause_info;
|
||||||
new_joininfo->mergesortable = mergesortable;
|
new_joininfo->mergejoinable = mergejoinable;
|
||||||
new_joininfo->hashjoinable = hashjoinable;
|
new_joininfo->hashjoinable = hashjoinable;
|
||||||
new_joininfo->inactive = false;
|
new_joininfo->inactive = false;
|
||||||
joinrel->joininfo =
|
joinrel->joininfo =
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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_sort_ = true;
|
||||||
bool _enable_hash_ = true;
|
bool _enable_hash_ = true;
|
||||||
bool _enable_nestloop_ = true;
|
bool _enable_nestloop_ = true;
|
||||||
bool _enable_mergesort_ = true;
|
bool _enable_mergejoin_ = true;
|
||||||
bool _enable_hashjoin_ = true;
|
bool _enable_hashjoin_ = true;
|
||||||
|
|
||||||
Cost _cpu_page_wight_ = _CPU_PAGE_WEIGHT_;
|
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
|
* 'outercost' and 'innercost' are the (disk+cpu) costs of scanning the
|
||||||
* outer and inner relations
|
* outer and inner relations
|
||||||
* 'outersortkeys' and 'innersortkeys' are lists of the keys to be used
|
* 'outersortkeys' and 'innersortkeys' are lists of the keys to be used
|
||||||
@ -273,7 +273,7 @@ cost_nestloop(Cost outercost,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
Cost
|
Cost
|
||||||
cost_mergesort(Cost outercost,
|
cost_mergejoin(Cost outercost,
|
||||||
Cost innercost,
|
Cost innercost,
|
||||||
List *outersortkeys,
|
List *outersortkeys,
|
||||||
List *innersortkeys,
|
List *innersortkeys,
|
||||||
@ -284,7 +284,7 @@ cost_mergesort(Cost outercost,
|
|||||||
{
|
{
|
||||||
Cost temp = 0;
|
Cost temp = 0;
|
||||||
|
|
||||||
if (!_enable_mergesort_)
|
if (!_enable_mergejoin_)
|
||||||
temp += _disable_cost_;
|
temp += _disable_cost_;
|
||||||
|
|
||||||
temp += outercost;
|
temp += outercost;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* 'rel' is the relation for which 'index' is defined
|
||||||
* 'clausegroup-list' is the list of clause groups (lists of clauseinfo
|
* 'clausegroup-list' is the list of clause groups (lists of clauseinfo
|
||||||
* nodes) grouped by mergesortorder
|
* nodes) grouped by mergejoinorder
|
||||||
* 'join' is a flag indicating whether or not the clauses are join
|
* 'join' is a flag indicating whether or not the clauses are join
|
||||||
* clauses
|
* clauses
|
||||||
*
|
*
|
||||||
@ -1284,7 +1284,7 @@ create_index_paths(Query *root,
|
|||||||
clauseinfo = (CInfo *) lfirst(j);
|
clauseinfo = (CInfo *) lfirst(j);
|
||||||
if (!(join_clause_p((Node *) clauseinfo->clause) &&
|
if (!(join_clause_p((Node *) clauseinfo->clause) &&
|
||||||
equal_path_merge_ordering(index->ordering,
|
equal_path_merge_ordering(index->ordering,
|
||||||
clauseinfo->mergesortorder)))
|
clauseinfo->mergejoinorder)))
|
||||||
temp = false;
|
temp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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/pathnode.h"
|
||||||
#include "optimizer/keys.h"
|
#include "optimizer/keys.h"
|
||||||
#include "optimizer/cost.h" /* for _enable_{hashjoin,
|
#include "optimizer/cost.h" /* for _enable_{hashjoin,
|
||||||
* _enable_mergesort} */
|
* _enable_mergejoin} */
|
||||||
|
|
||||||
static Path *best_innerjoin(List *join_paths, List *outer_relid);
|
static Path *best_innerjoin(List *join_paths, List *outer_relid);
|
||||||
static List *
|
static List *
|
||||||
@ -98,7 +98,7 @@ find_all_join_paths(Query *root, List *joinrels)
|
|||||||
|
|
||||||
bestinnerjoin = best_innerjoin(innerrel->innerjoin,
|
bestinnerjoin = best_innerjoin(innerrel->innerjoin,
|
||||||
outerrel->relids);
|
outerrel->relids);
|
||||||
if (_enable_mergesort_)
|
if (_enable_mergejoin_)
|
||||||
{
|
{
|
||||||
mergeinfo_list =
|
mergeinfo_list =
|
||||||
group_clauses_by_order(joinrel->clauseinfo,
|
group_clauses_by_order(joinrel->clauseinfo,
|
||||||
@ -116,7 +116,7 @@ find_all_join_paths(Query *root, List *joinrels)
|
|||||||
joinrel->relids = intAppend(outerrelids, innerrelids);
|
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.
|
* explicitly sorted.
|
||||||
*/
|
*/
|
||||||
pathlist = sort_inner_and_outer(joinrel, outerrel,
|
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
|
* 2. Consider paths where the outer relation need not be
|
||||||
* explicitly sorted. This may include either nestloops and
|
* 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 =
|
pathlist =
|
||||||
add_pathlist(joinrel, 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
|
* 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
|
* the actual nestloop nodes were constructed in
|
||||||
* (match-unsorted-outer).
|
* (match-unsorted-outer).
|
||||||
*/
|
*/
|
||||||
@ -226,16 +226,16 @@ best_innerjoin(List *join_paths, List *outer_relids)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* sort-inner-and-outer--
|
* 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.
|
* inner join relations on each available merge ordering.
|
||||||
*
|
*
|
||||||
* 'joinrel' is the join relation
|
* 'joinrel' is the join relation
|
||||||
* 'outerrel' is the outer join relation
|
* 'outerrel' is the outer join relation
|
||||||
* 'innerrel' is the inner 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
|
* clauses for joining the relations
|
||||||
*
|
*
|
||||||
* Returns a list of mergesort paths.
|
* Returns a list of mergejoin paths.
|
||||||
*/
|
*/
|
||||||
static List *
|
static List *
|
||||||
sort_inner_and_outer(RelOptInfo *joinrel,
|
sort_inner_and_outer(RelOptInfo *joinrel,
|
||||||
@ -270,7 +270,7 @@ sort_inner_and_outer(RelOptInfo *joinrel,
|
|||||||
xmergeinfo->jmethod.clauses);
|
xmergeinfo->jmethod.clauses);
|
||||||
|
|
||||||
temp_node =
|
temp_node =
|
||||||
create_mergesort_path(joinrel,
|
create_mergejoin_path(joinrel,
|
||||||
outerrel->size,
|
outerrel->size,
|
||||||
innerrel->size,
|
innerrel->size,
|
||||||
outerrel->width,
|
outerrel->width,
|
||||||
@ -292,12 +292,12 @@ sort_inner_and_outer(RelOptInfo *joinrel,
|
|||||||
* match-unsorted-outer--
|
* match-unsorted-outer--
|
||||||
* Creates possible join paths for processing a single join relation
|
* Creates possible join paths for processing a single join relation
|
||||||
* 'joinrel' by employing either iterative substitution or
|
* '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).
|
* outer relation need not be explicitly sorted).
|
||||||
*
|
*
|
||||||
* 1. The inner path is the cheapest available inner path.
|
* 1. The inner path is the cheapest available inner path.
|
||||||
* 2. Mergesort wherever possible. Mergesorts are considered if there
|
* 2. Mergejoin wherever possible. Mergejoin are considered if there
|
||||||
* are mergesortable join clauses between the outer and inner join
|
* are mergejoinable join clauses between the outer and inner join
|
||||||
* relations such that the outer path is keyed on the variables
|
* relations such that the outer path is keyed on the variables
|
||||||
* appearing in the clauses. The corresponding inner merge path is
|
* appearing in the clauses. The corresponding inner merge path is
|
||||||
* either a path whose keys match those of the outer path(if such a
|
* 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
|
* 'outerpath-list' is the list of possible outer paths
|
||||||
* 'cheapest-inner' is the cheapest inner path
|
* 'cheapest-inner' is the cheapest inner path
|
||||||
* 'best-innerjoin' is the best inner index path(if any)
|
* '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
|
* clauses
|
||||||
*
|
*
|
||||||
* Returns a list of possible join path nodes.
|
* Returns a list of possible join path nodes.
|
||||||
@ -424,7 +424,7 @@ match_unsorted_outer(RelOptInfo *joinrel,
|
|||||||
mergeinnerpath = cheapest_inner;
|
mergeinnerpath = cheapest_inner;
|
||||||
|
|
||||||
temp_node =
|
temp_node =
|
||||||
lcons(create_mergesort_path(joinrel,
|
lcons(create_mergejoin_path(joinrel,
|
||||||
outerrel->size,
|
outerrel->size,
|
||||||
innerrel->size,
|
innerrel->size,
|
||||||
outerrel->width,
|
outerrel->width,
|
||||||
@ -463,7 +463,7 @@ match_unsorted_outer(RelOptInfo *joinrel,
|
|||||||
* 'outerrel' is the outer join relation
|
* 'outerrel' is the outer join relation
|
||||||
* 'innerrel' is the inner join relation
|
* 'innerrel' is the inner join relation
|
||||||
* 'innerpath-list' is the list of possible inner join paths
|
* '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
|
* clauses
|
||||||
*
|
*
|
||||||
* Returns a list of possible merge paths.
|
* Returns a list of possible merge paths.
|
||||||
@ -542,7 +542,7 @@ match_unsorted_inner(RelOptInfo *joinrel,
|
|||||||
clauses);
|
clauses);
|
||||||
|
|
||||||
temp_node =
|
temp_node =
|
||||||
lcons(create_mergesort_path(joinrel,
|
lcons(create_mergejoin_path(joinrel,
|
||||||
outerrel->size,
|
outerrel->size,
|
||||||
innerrel->size,
|
innerrel->size,
|
||||||
outerrel->width,
|
outerrel->width,
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
joininfo->otherrels;
|
||||||
other_joininfo->jinfoclauseinfo =
|
other_joininfo->jinfoclauseinfo =
|
||||||
joininfo->jinfoclauseinfo;
|
joininfo->jinfoclauseinfo;
|
||||||
other_joininfo->mergesortable =
|
other_joininfo->mergejoinable =
|
||||||
joininfo->mergesortable;
|
joininfo->mergejoinable;
|
||||||
other_joininfo->hashjoinable =
|
other_joininfo->hashjoinable =
|
||||||
joininfo->hashjoinable;
|
joininfo->hashjoinable;
|
||||||
other_joininfo->inactive = false;
|
other_joininfo->inactive = false;
|
||||||
@ -415,7 +415,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
|||||||
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
JInfo *joininfo = (JInfo *) lfirst(xjoininfo);
|
||||||
List *other_rels = joininfo->otherrels;
|
List *other_rels = joininfo->otherrels;
|
||||||
List *clause_info = joininfo->jinfoclauseinfo;
|
List *clause_info = joininfo->jinfoclauseinfo;
|
||||||
bool mergesortable = joininfo->mergesortable;
|
bool mergejoinable = joininfo->mergejoinable;
|
||||||
bool hashjoinable = joininfo->hashjoinable;
|
bool hashjoinable = joininfo->hashjoinable;
|
||||||
|
|
||||||
foreach(xrelid, other_rels)
|
foreach(xrelid, other_rels)
|
||||||
@ -428,7 +428,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
|||||||
|
|
||||||
new_joininfo->otherrels = joinrel->relids;
|
new_joininfo->otherrels = joinrel->relids;
|
||||||
new_joininfo->jinfoclauseinfo = clause_info;
|
new_joininfo->jinfoclauseinfo = clause_info;
|
||||||
new_joininfo->mergesortable = mergesortable;
|
new_joininfo->mergejoinable = mergejoinable;
|
||||||
new_joininfo->hashjoinable = hashjoinable;
|
new_joininfo->hashjoinable = hashjoinable;
|
||||||
new_joininfo->inactive = false;
|
new_joininfo->inactive = false;
|
||||||
rel->joininfo =
|
rel->joininfo =
|
||||||
@ -457,7 +457,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
|
|||||||
|
|
||||||
new_joininfo->otherrels = new_relids;
|
new_joininfo->otherrels = new_relids;
|
||||||
new_joininfo->jinfoclauseinfo = clause_info;
|
new_joininfo->jinfoclauseinfo = clause_info;
|
||||||
new_joininfo->mergesortable = mergesortable;
|
new_joininfo->mergejoinable = mergejoinable;
|
||||||
new_joininfo->hashjoinable = hashjoinable;
|
new_joininfo->hashjoinable = hashjoinable;
|
||||||
new_joininfo->inactive = false;
|
new_joininfo->inactive = false;
|
||||||
joinrel->joininfo =
|
joinrel->joininfo =
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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--
|
* 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
|
* it within a mergeinfo node containing other clause nodes with the same
|
||||||
* mergesort ordering.
|
* mergejoin ordering.
|
||||||
*
|
*
|
||||||
* 'clauseinfo-list' is the list of clauseinfo nodes
|
* 'clauseinfo-list' is the list of clauseinfo nodes
|
||||||
* 'inner-relid' is the relid of the inner join relation
|
* '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)
|
foreach(xclauseinfo, clauseinfo_list)
|
||||||
{
|
{
|
||||||
CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
|
CInfo *clauseinfo = (CInfo *) lfirst(xclauseinfo);
|
||||||
MergeOrder *merge_ordering = clauseinfo->mergesortorder;
|
MergeOrder *merge_ordering = clauseinfo->mergejoinorder;
|
||||||
|
|
||||||
if (merge_ordering)
|
if (merge_ordering)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
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_path_cost((Path) get_innerjoinpath(mrgnode)),
|
||||||
get_outersortkeys(mrgnode),
|
get_outersortkeys(mrgnode),
|
||||||
get_innersortkeys(mrgnode),
|
get_innersortkeys(mrgnode),
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
List *hashclauses, Plan *lefttree, Plan *righttree);
|
||||||
static Hash *make_hash(List *tlist, Var *hashkey, Plan *lefttree);
|
static Hash *make_hash(List *tlist, Var *hashkey, Plan *lefttree);
|
||||||
static MergeJoin *
|
static MergeJoin *
|
||||||
make_mergesort(List *tlist, List *qpqual,
|
make_mergejoin(List *tlist, List *qpqual,
|
||||||
List *mergeclauses, Oid opcode, Oid *rightorder,
|
List *mergeclauses, Oid opcode, Oid *rightorder,
|
||||||
Oid *leftorder, Plan *righttree, Plan *lefttree);
|
Oid *leftorder, Plan *righttree, Plan *lefttree);
|
||||||
static Material *
|
static Material *
|
||||||
@ -584,7 +584,7 @@ create_mergejoin_node(MergePath *best_path,
|
|||||||
inner_node = (Plan *) sorted_inner_node;
|
inner_node = (Plan *) sorted_inner_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
join_node = make_mergesort(tlist,
|
join_node = make_mergejoin(tlist,
|
||||||
qpqual,
|
qpqual,
|
||||||
mergeclauses,
|
mergeclauses,
|
||||||
opcode,
|
opcode,
|
||||||
@ -1038,7 +1038,7 @@ make_hash(List *tlist, Var *hashkey, Plan *lefttree)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static MergeJoin *
|
static MergeJoin *
|
||||||
make_mergesort(List *tlist,
|
make_mergejoin(List *tlist,
|
||||||
List *qpqual,
|
List *qpqual,
|
||||||
List *mergeclauses,
|
List *mergeclauses,
|
||||||
Oid opcode,
|
Oid opcode,
|
||||||
@ -1058,7 +1058,7 @@ make_mergesort(List *tlist,
|
|||||||
plan->lefttree = lefttree;
|
plan->lefttree = lefttree;
|
||||||
plan->righttree = righttree;
|
plan->righttree = righttree;
|
||||||
node->mergeclauses = mergeclauses;
|
node->mergeclauses = mergeclauses;
|
||||||
node->mergesortop = opcode;
|
node->mergejoinop = opcode;
|
||||||
node->mergerightorder = rightorder;
|
node->mergerightorder = rightorder;
|
||||||
node->mergeleftorder = leftorder;
|
node->mergeleftorder = leftorder;
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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);
|
List *join_relids);
|
||||||
static void add_vars_to_rels(Query *root, List *vars, 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);
|
static Oid hashjoinop(Expr *clause);
|
||||||
|
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ add_clause_to_rels(Query *root, List *clause)
|
|||||||
clauseinfo->notclause = contains_not((Node *) clause);
|
clauseinfo->notclause = contains_not((Node *) clause);
|
||||||
clauseinfo->selectivity = 0;
|
clauseinfo->selectivity = 0;
|
||||||
clauseinfo->indexids = NIL;
|
clauseinfo->indexids = NIL;
|
||||||
clauseinfo->mergesortorder = (MergeOrder *) NULL;
|
clauseinfo->mergejoinorder = (MergeOrder *) NULL;
|
||||||
clauseinfo->hashjoinoperator = (Oid) 0;
|
clauseinfo->hashjoinoperator = (Oid) 0;
|
||||||
|
|
||||||
|
|
||||||
@ -324,8 +324,8 @@ add_vars_to_rels(Query *root, List *vars, List *join_relids)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize-join-clause-info--
|
* initialize-join-clause-info--
|
||||||
* Set the MergeSortable or HashJoinable field for every joininfo node
|
* Set the MergeJoinable or HashJoinable field for every joininfo node
|
||||||
* (within a rel node) and the MergeSortOrder or HashJoinOp field for
|
* (within a rel node) and the MergeJoinOrder or HashJoinOp field for
|
||||||
* each clauseinfo node(within a joininfo node) for all relations in a
|
* each clauseinfo node(within a joininfo node) for all relations in a
|
||||||
* query.
|
* query.
|
||||||
*
|
*
|
||||||
@ -357,15 +357,15 @@ initialize_join_clause_info(List *rel_list)
|
|||||||
MergeOrder *sortop = (MergeOrder *) NULL;
|
MergeOrder *sortop = (MergeOrder *) NULL;
|
||||||
Oid hashop = (Oid) NULL;
|
Oid hashop = (Oid) NULL;
|
||||||
|
|
||||||
if (_enable_mergesort_)
|
if (_enable_mergejoin_)
|
||||||
sortop = mergesortop(clause);
|
sortop = mergejoinop(clause);
|
||||||
if (_enable_hashjoin_)
|
if (_enable_hashjoin_)
|
||||||
hashop = hashjoinop(clause);
|
hashop = hashjoinop(clause);
|
||||||
|
|
||||||
if (sortop)
|
if (sortop)
|
||||||
{
|
{
|
||||||
clauseinfo->mergesortorder = sortop;
|
clauseinfo->mergejoinorder = sortop;
|
||||||
joininfo->mergesortable = true;
|
joininfo->mergejoinable = true;
|
||||||
}
|
}
|
||||||
if (hashop)
|
if (hashop)
|
||||||
{
|
{
|
||||||
@ -379,19 +379,19 @@ initialize_join_clause_info(List *rel_list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mergesortop--
|
* mergejoinop--
|
||||||
* Returns the mergesort operator of an operator iff 'clause' is
|
* Returns the mergejoin operator of an operator iff 'clause' is
|
||||||
* mergesortable, i.e., both operands are single vars and the operator is
|
* mergejoinable, i.e., both operands are single vars and the operator is
|
||||||
* a mergesortable operator.
|
* a mergejoinable operator.
|
||||||
*/
|
*/
|
||||||
static MergeOrder *
|
static MergeOrder *
|
||||||
mergesortop(Expr *clause)
|
mergejoinop(Expr *clause)
|
||||||
{
|
{
|
||||||
Oid leftOp,
|
Oid leftOp,
|
||||||
rightOp;
|
rightOp;
|
||||||
bool sortable;
|
bool sortable;
|
||||||
|
|
||||||
sortable = op_mergesortable(((Oper *) clause->oper)->opno,
|
sortable = op_mergejoinable(((Oper *) clause->oper)->opno,
|
||||||
(get_leftop(clause))->vartype,
|
(get_leftop(clause))->vartype,
|
||||||
(get_rightop(clause))->vartype,
|
(get_rightop(clause))->vartype,
|
||||||
&leftOp,
|
&leftOp,
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 = makeNode(JInfo);
|
||||||
joininfo->otherrels = join_relids;
|
joininfo->otherrels = join_relids;
|
||||||
joininfo->jinfoclauseinfo = NIL;
|
joininfo->jinfoclauseinfo = NIL;
|
||||||
joininfo->mergesortable = false;
|
joininfo->mergejoinable = false;
|
||||||
joininfo->hashjoinable = false;
|
joininfo->hashjoinable = false;
|
||||||
joininfo->inactive = false;
|
joininfo->inactive = false;
|
||||||
this_rel->joininfo = lcons(joininfo, this_rel->joininfo);
|
this_rel->joininfo = lcons(joininfo, this_rel->joininfo);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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--
|
* create_mergejoin_path--
|
||||||
* Creates a pathnode corresponding to a mergesort join between
|
* Creates a pathnode corresponding to a mergejoin join between
|
||||||
* two relations
|
* two relations
|
||||||
*
|
*
|
||||||
* 'joinrel' is the join relation
|
* 'joinrel' is the join relation
|
||||||
@ -481,7 +481,7 @@ create_nestloop_path(RelOptInfo *joinrel,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
MergePath *
|
MergePath *
|
||||||
create_mergesort_path(RelOptInfo *joinrel,
|
create_mergejoin_path(RelOptInfo *joinrel,
|
||||||
int outersize,
|
int outersize,
|
||||||
int innersize,
|
int innersize,
|
||||||
int outerwidth,
|
int outerwidth,
|
||||||
@ -509,7 +509,7 @@ create_mergesort_path(RelOptInfo *joinrel,
|
|||||||
pathnode->outersortkeys = outersortkeys;
|
pathnode->outersortkeys = outersortkeys;
|
||||||
pathnode->innersortkeys = innersortkeys;
|
pathnode->innersortkeys = innersortkeys;
|
||||||
pathnode->jpath.path.path_cost =
|
pathnode->jpath.path.path_cost =
|
||||||
cost_mergesort(outer_path->path_cost,
|
cost_mergejoin(outer_path->path_cost,
|
||||||
inner_path->path_cost,
|
inner_path->path_cost,
|
||||||
outersortkeys,
|
outersortkeys,
|
||||||
innersortkeys,
|
innersortkeys,
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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
|
* NOTES
|
||||||
* this is the "main" module of the postgres backend and
|
* 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;
|
_enable_nestloop_ = false;
|
||||||
break;
|
break;
|
||||||
case 'm': /* mergejoin */
|
case 'm': /* mergejoin */
|
||||||
_enable_mergesort_ = false;
|
_enable_mergejoin_ = false;
|
||||||
break;
|
break;
|
||||||
case 'h': /* hashjoin */
|
case 'h': /* hashjoin */
|
||||||
_enable_hashjoin_ = false;
|
_enable_hashjoin_ = false;
|
||||||
@ -1339,7 +1339,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
|||||||
if (!IsUnderPostmaster)
|
if (!IsUnderPostmaster)
|
||||||
{
|
{
|
||||||
puts("\nPOSTGRES backend interactive interface");
|
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
|
* 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
|
* NOTES
|
||||||
* Eventually, the index information should go through here, too.
|
* 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
|
* 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
|
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;
|
FormData_pg_operator optup;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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;
|
Join join;
|
||||||
List *mergeclauses;
|
List *mergeclauses;
|
||||||
Oid mergesortop;
|
Oid mergejoinop;
|
||||||
Oid *mergerightorder;/* inner sort operator */
|
Oid *mergerightorder;/* inner sort operator */
|
||||||
Oid *mergeleftorder; /* outer sort operator */
|
Oid *mergeleftorder; /* outer sort operator */
|
||||||
MergeJoinState *mergestate;
|
MergeJoinState *mergestate;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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;
|
bool notclause;
|
||||||
List *indexids;
|
List *indexids;
|
||||||
|
|
||||||
/* mergesort only */
|
/* mergejoin only */
|
||||||
MergeOrder *mergesortorder;
|
MergeOrder *mergejoinorder;
|
||||||
|
|
||||||
/* hashjoin only */
|
/* hashjoin only */
|
||||||
Oid hashjoinoperator;
|
Oid hashjoinoperator;
|
||||||
@ -247,7 +247,7 @@ typedef struct JInfo
|
|||||||
NodeTag type;
|
NodeTag type;
|
||||||
List *otherrels;
|
List *otherrels;
|
||||||
List *jinfoclauseinfo;
|
List *jinfoclauseinfo;
|
||||||
bool mergesortable;
|
bool mergejoinable;
|
||||||
bool hashjoinable;
|
bool hashjoinable;
|
||||||
bool inactive;
|
bool inactive;
|
||||||
} JInfo;
|
} JInfo;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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_sort_;
|
||||||
extern bool _enable_hash_;
|
extern bool _enable_hash_;
|
||||||
extern bool _enable_nestloop_;
|
extern bool _enable_nestloop_;
|
||||||
extern bool _enable_mergesort_;
|
extern bool _enable_mergejoin_;
|
||||||
extern bool _enable_hashjoin_;
|
extern bool _enable_hashjoin_;
|
||||||
|
|
||||||
extern Cost cost_seqscan(int relid, int relpages, int reltuples);
|
extern Cost cost_seqscan(int relid, int relpages, int reltuples);
|
||||||
@ -40,7 +40,7 @@ extern Cost
|
|||||||
cost_nestloop(Cost outercost, Cost innercost, int outertuples,
|
cost_nestloop(Cost outercost, Cost innercost, int outertuples,
|
||||||
int innertuples, int outerpages, bool is_indexjoin);
|
int innertuples, int outerpages, bool is_indexjoin);
|
||||||
extern Cost
|
extern Cost
|
||||||
cost_mergesort(Cost outercost, Cost innercost,
|
cost_mergejoin(Cost outercost, Cost innercost,
|
||||||
List *outersortkeys, List *innersortkeys,
|
List *outersortkeys, List *innersortkeys,
|
||||||
int outersize, int innersize, int outerwidth, int innerwidth);
|
int outersize, int innersize, int outerwidth, int innerwidth);
|
||||||
extern Cost
|
extern Cost
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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,
|
create_nestloop_path(RelOptInfo *joinrel, RelOptInfo *outer_rel,
|
||||||
Path *outer_path, Path *inner_path, List *keys);
|
Path *outer_path, Path *inner_path, List *keys);
|
||||||
extern MergePath *
|
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,
|
int innersize, int outerwidth, int innerwidth, Path *outer_path,
|
||||||
Path *inner_path, List *keys, MergeOrder *order,
|
Path *inner_path, List *keys, MergeOrder *order,
|
||||||
List *mergeclauses, List *outersortkeys, List *innersortkeys);
|
List *mergeclauses, List *outersortkeys, List *innersortkeys);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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 RegProcedure get_opcode(Oid opid);
|
||||||
extern char *get_opname(Oid opid);
|
extern char *get_opname(Oid opid);
|
||||||
extern bool
|
extern bool
|
||||||
op_mergesortable(Oid opid, Oid ltype, Oid rtype,
|
op_mergejoinable(Oid opid, Oid ltype, Oid rtype,
|
||||||
Oid *leftOp, Oid *rightOp);
|
Oid *leftOp, Oid *rightOp);
|
||||||
extern Oid op_hashjoinable(Oid opid, Oid ltype, Oid rtype);
|
extern Oid op_hashjoinable(Oid opid, Oid ltype, Oid rtype);
|
||||||
extern Oid get_commutator(Oid opid);
|
extern Oid get_commutator(Oid opid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user