Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
d9be0ff4
Commit
d9be0ff4
authored
Aug 04, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MergeSort was sometimes called mergejoin and was confusing. Now
it is now only mergejoin.
parent
7db9ea5c
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
117 additions
and
116 deletions
+117
-116
src/backend/commands/explain.c
src/backend/commands/explain.c
+5
-4
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+4
-4
src/backend/nodes/equalfuncs.c
src/backend/nodes/equalfuncs.c
+3
-3
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+6
-6
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+9
-9
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/geqo/geqo_eval.c
+6
-6
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/costsize.c
+5
-5
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/indxpath.c
+3
-3
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinpath.c
+17
-17
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/joinrels.c
+6
-6
src/backend/optimizer/path/mergeutils.c
src/backend/optimizer/path/mergeutils.c
+4
-4
src/backend/optimizer/path/xfunc.c
src/backend/optimizer/path/xfunc.c
+2
-2
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/createplan.c
+5
-5
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/initsplan.c
+15
-15
src/backend/optimizer/util/joininfo.c
src/backend/optimizer/util/joininfo.c
+2
-2
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/pathnode.c
+5
-5
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+3
-3
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/lsyscache.c
+4
-4
src/include/nodes/plannodes.h
src/include/nodes/plannodes.h
+2
-2
src/include/nodes/relation.h
src/include/nodes/relation.h
+4
-4
src/include/optimizer/cost.h
src/include/optimizer/cost.h
+3
-3
src/include/optimizer/pathnode.h
src/include/optimizer/pathnode.h
+2
-2
src/include/utils/lsyscache.h
src/include/utils/lsyscache.h
+2
-2
No files found.
src/backend/commands/explain.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.2
2 1998/08/04 15:00:26
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.2
3 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
);
}
...
...
src/backend/nodes/copyfuncs.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.4
5 1998/08/01 22:12:05
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.4
6 1998/08/04 16:43:56
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -335,7 +335,7 @@ _copyMergeJoin(MergeJoin *from)
*/
Node_Copy
(
from
,
newnode
,
mergeclauses
);
newnode
->
merge
sortop
=
from
->
mergesort
op
;
newnode
->
merge
joinop
=
from
->
mergejoin
op
;
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
,
merge
sort
order
);
Node_Copy
(
from
,
newnode
,
merge
join
order
);
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
->
merge
sortable
=
from
->
mergesort
able
;
newnode
->
merge
joinable
=
from
->
mergejoin
able
;
newnode
->
hashjoinable
=
from
->
hashjoinable
;
newnode
->
inactive
=
from
->
inactive
;
...
...
src/backend/nodes/equalfuncs.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.1
7 1998/08/01 22:12:07
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.1
8 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
->
merge
sortorder
,
b
->
mergesort
order
))
if
(
!
EqualMergeOrder
(
a
->
merge
joinorder
,
b
->
mergejoin
order
))
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
->
merge
sortable
!=
b
->
mergesort
able
)
if
(
a
->
merge
joinable
!=
b
->
mergejoin
able
)
return
(
false
);
if
(
a
->
hashjoinable
!=
b
->
hashjoinable
)
return
(
false
);
...
...
src/backend/nodes/outfuncs.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.4
2 1998/08/01 22:12:08
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.4
3 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
,
" :merge
sortop %u "
,
node
->
mergesort
op
);
sprintf
(
buf
,
" :merge
joinop %u "
,
node
->
mergejoin
op
);
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
,
" :merge
sort
order "
);
_outNode
(
str
,
node
->
merge
sort
order
);
appendStringInfo
(
str
,
" :merge
join
order "
);
_outNode
(
str
,
node
->
merge
join
order
);
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
,
" :merge
sort
able "
);
appendStringInfo
(
str
,
node
->
merge
sort
able
?
"true"
:
"false"
);
appendStringInfo
(
str
,
" :merge
join
able "
);
appendStringInfo
(
str
,
node
->
merge
join
able
?
"true"
:
"false"
);
appendStringInfo
(
str
,
" :hashjoinable "
);
appendStringInfo
(
str
,
node
->
hashjoinable
?
"true"
:
"false"
);
...
...
src/backend/nodes/readfuncs.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.3
4 1998/08/01 22:12:09
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.3
5 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 :merge
sort
op */
token
=
lsptok
(
NULL
,
&
length
);
/* get merge
sort
op */
local_node
->
merge
sort
op
=
atol
(
token
);
token
=
lsptok
(
NULL
,
&
length
);
/* eat :merge
join
op */
token
=
lsptok
(
NULL
,
&
length
);
/* get merge
join
op */
local_node
->
merge
join
op
=
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 :merge
sort
order */
local_node
->
merge
sort
order
=
(
MergeOrder
*
)
nodeRead
(
true
);
token
=
lsptok
(
NULL
,
&
length
);
/* get :merge
join
order */
local_node
->
merge
join
order
=
(
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 :merge
sort
able */
token
=
lsptok
(
NULL
,
&
length
);
/* get :merge
join
able */
if
(
!
strncmp
(
token
,
"true"
,
4
))
local_node
->
merge
sort
able
=
true
;
local_node
->
merge
join
able
=
true
;
else
local_node
->
merge
sort
able
=
false
;
local_node
->
merge
join
able
=
false
;
token
=
lsptok
(
NULL
,
&
length
);
/* get :hashjoinable */
...
...
src/backend/optimizer/geqo/geqo_eval.c
View file @
d9be0ff4
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_eval.c,v 1.2
0 1998/07/18 04:22:27
momjian Exp $
* $Id: geqo_eval.c,v 1.2
1 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
->
merge
sort
able
=
joininfo
->
merge
sort
able
;
other_joininfo
->
merge
join
able
=
joininfo
->
merge
join
able
;
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
merge
sortable
=
joininfo
->
mergesort
able
;
bool
merge
joinable
=
joininfo
->
mergejoin
able
;
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
->
merge
sortable
=
mergesort
able
;
new_joininfo
->
merge
joinable
=
mergejoin
able
;
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
->
merge
sortable
=
mergesort
able
;
new_joininfo
->
merge
joinable
=
mergejoin
able
;
new_joininfo
->
hashjoinable
=
hashjoinable
;
new_joininfo
->
inactive
=
false
;
joinrel
->
joininfo
=
...
...
src/backend/optimizer/path/costsize.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.2
2 1998/07/18 04:22:31
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.2
3 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_merge
sort
_
=
true
;
bool
_enable_merge
join
_
=
true
;
bool
_enable_hashjoin_
=
true
;
Cost
_cpu_page_wight_
=
_CPU_PAGE_WEIGHT_
;
...
...
@@ -259,7 +259,7 @@ cost_nestloop(Cost outercost,
}
/*
* cost_merge
sort
--
* cost_merge
join
--
* '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_merge
sort
(
Cost
outercost
,
cost_merge
join
(
Cost
outercost
,
Cost
innercost
,
List
*
outersortkeys
,
List
*
innersortkeys
,
...
...
@@ -284,7 +284,7 @@ cost_mergesort(Cost outercost,
{
Cost
temp
=
0
;
if
(
!
_enable_merge
sort
_
)
if
(
!
_enable_merge
join
_
)
temp
+=
_disable_cost_
;
temp
+=
outercost
;
...
...
src/backend/optimizer/path/indxpath.c
View file @
d9be0ff4
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.2
4 1998/08/04 00:42:08
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.2
5 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 merge
sort
order
* nodes) grouped by merge
join
order
* '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
->
merge
sort
order
)))
clauseinfo
->
merge
join
order
)))
temp
=
false
;
}
...
...
src/backend/optimizer/path/joinpath.c
View file @
d9be0ff4
...
...
@@ -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_merge
sort
} */
* _enable_merge
join
} */
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_merge
sort
_
)
if
(
_enable_merge
join
_
)
{
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 merge
sort
paths where both relations must be
* 1. Consider merge
join
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
* merge
sort
s where the outer path is already ordered.
* merge
join
s 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 merge
sort
s
* explicitly sorted. This may include nestloops and merge
join
s
* 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 merge
sort
join paths by explicitly sorting both the outer and
* Create merge
join
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(merge
sort
able)
* 'mergeinfo-list' is a list of nodes containing info on(merge
join
able)
* clauses for joining the relations
*
* Returns a list of merge
sort
paths.
* Returns a list of merge
join
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_merge
sort
_path
(
joinrel
,
create_merge
join
_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
* merge
sort
ing on each of its possible outer paths(assuming that the
* merge
join
ing 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. Merge
sort wherever possible. Mergesorts
are considered if there
* are merge
sort
able join clauses between the outer and inner join
* 2. Merge
join wherever possible. Mergejoin
are considered if there
* are merge
join
able 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 merge
sort
able
* 'mergeinfo-list' is a list of nodes containing info on merge
join
able
* 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_merge
sort
_path
(
joinrel
,
lcons
(
create_merge
join
_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 merge
sort
able
* 'mergeinfo-list' is a list of nodes containing info on merge
join
able
* clauses
*
* Returns a list of possible merge paths.
...
...
@@ -542,7 +542,7 @@ match_unsorted_inner(RelOptInfo *joinrel,
clauses
);
temp_node
=
lcons
(
create_merge
sort
_path
(
joinrel
,
lcons
(
create_merge
join
_path
(
joinrel
,
outerrel
->
size
,
innerrel
->
size
,
outerrel
->
width
,
...
...
src/backend/optimizer/path/joinrels.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.1
1 1998/07/18 04:22:33
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.1
2 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
->
merge
sort
able
=
joininfo
->
merge
sort
able
;
other_joininfo
->
merge
join
able
=
joininfo
->
merge
join
able
;
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
merge
sortable
=
joininfo
->
mergesort
able
;
bool
merge
joinable
=
joininfo
->
mergejoin
able
;
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
->
merge
sortable
=
mergesort
able
;
new_joininfo
->
merge
joinable
=
mergejoin
able
;
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
->
merge
sortable
=
mergesort
able
;
new_joininfo
->
merge
joinable
=
mergejoin
able
;
new_joininfo
->
hashjoinable
=
hashjoinable
;
new_joininfo
->
inactive
=
false
;
joinrel
->
joininfo
=
...
...
src/backend/optimizer/path/mergeutils.c
View file @
d9be0ff4
...
...
@@ -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 merge
sort
able, store
* If a join clause node in 'clauseinfo-list' is merge
join
able, store
* it within a mergeinfo node containing other clause nodes with the same
* merge
sort
ordering.
* merge
join
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
->
merge
sort
order
;
MergeOrder
*
merge_ordering
=
clauseinfo
->
merge
join
order
;
if
(
merge_ordering
)
{
...
...
src/backend/optimizer/path/xfunc.c
View file @
d9be0ff4
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.1
6 1998/07/18 04:22:34
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.1
7 1998/08/04 16:44:11
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1022,7 +1022,7 @@ xfunc_total_path_cost(JoinPath pathnode)
{
MergePath
mrgnode
=
(
MergePath
)
pathnode
;
cost
+=
cost_merge
sort
(
get_path_cost
((
Path
)
get_outerjoinpath
(
mrgnode
)),
cost
+=
cost_merge
join
(
get_path_cost
((
Path
)
get_outerjoinpath
(
mrgnode
)),
get_path_cost
((
Path
)
get_innerjoinpath
(
mrgnode
)),
get_outersortkeys
(
mrgnode
),
get_innersortkeys
(
mrgnode
),
...
...
src/backend/optimizer/plan/createplan.c
View file @
d9be0ff4
...
...
@@ -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_merge
sort
(
List
*
tlist
,
List
*
qpqual
,
make_merge
join
(
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_merge
sort
(
tlist
,
join_node
=
make_merge
join
(
tlist
,
qpqual
,
mergeclauses
,
opcode
,
...
...
@@ -1038,7 +1038,7 @@ make_hash(List *tlist, Var *hashkey, Plan *lefttree)
}
static
MergeJoin
*
make_merge
sort
(
List
*
tlist
,
make_merge
join
(
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
->
merge
sort
op
=
opcode
;
node
->
merge
join
op
=
opcode
;
node
->
mergerightorder
=
rightorder
;
node
->
mergeleftorder
=
leftorder
;
...
...
src/backend/optimizer/plan/initsplan.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.1
3 1998/07/18 04:22:37
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.1
4 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
*
merge
sort
op
(
Expr
*
clause
);
static
MergeOrder
*
merge
join
op
(
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
->
merge
sort
order
=
(
MergeOrder
*
)
NULL
;
clauseinfo
->
merge
join
order
=
(
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 Merge
Sort
able or HashJoinable field for every joininfo node
* (within a rel node) and the Merge
Sort
Order or HashJoinOp field for
* Set the Merge
Join
able or HashJoinable field for every joininfo node
* (within a rel node) and the Merge
Join
Order 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_merge
sort
_
)
sortop
=
merge
sort
op
(
clause
);
if
(
_enable_merge
join
_
)
sortop
=
merge
join
op
(
clause
);
if
(
_enable_hashjoin_
)
hashop
=
hashjoinop
(
clause
);
if
(
sortop
)
{
clauseinfo
->
merge
sort
order
=
sortop
;
joininfo
->
merge
sort
able
=
true
;
clauseinfo
->
merge
join
order
=
sortop
;
joininfo
->
merge
join
able
=
true
;
}
if
(
hashop
)
{
...
...
@@ -379,19 +379,19 @@ initialize_join_clause_info(List *rel_list)
}
/*
* merge
sort
op--
* Returns the merge
sort
operator of an operator iff 'clause' is
* merge
sort
able, i.e., both operands are single vars and the operator is
* a merge
sort
able operator.
* merge
join
op--
* Returns the merge
join
operator of an operator iff 'clause' is
* merge
join
able, i.e., both operands are single vars and the operator is
* a merge
join
able operator.
*/
static
MergeOrder
*
merge
sort
op
(
Expr
*
clause
)
merge
join
op
(
Expr
*
clause
)
{
Oid
leftOp
,
rightOp
;
bool
sortable
;
sortable
=
op_merge
sort
able
(((
Oper
*
)
clause
->
oper
)
->
opno
,
sortable
=
op_merge
join
able
(((
Oper
*
)
clause
->
oper
)
->
opno
,
(
get_leftop
(
clause
))
->
vartype
,
(
get_rightop
(
clause
))
->
vartype
,
&
leftOp
,
...
...
src/backend/optimizer/util/joininfo.c
View file @
d9be0ff4
...
...
@@ -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
->
merge
sort
able
=
false
;
joininfo
->
merge
join
able
=
false
;
joininfo
->
hashjoinable
=
false
;
joininfo
->
inactive
=
false
;
this_rel
->
joininfo
=
lcons
(
joininfo
,
this_rel
->
joininfo
);
...
...
src/backend/optimizer/util/pathnode.c
View file @
d9be0ff4
...
...
@@ -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_merge
sort
_path--
* Creates a pathnode corresponding to a merge
sort
join between
* create_merge
join
_path--
* Creates a pathnode corresponding to a merge
join
join between
* two relations
*
* 'joinrel' is the join relation
...
...
@@ -481,7 +481,7 @@ create_nestloop_path(RelOptInfo *joinrel,
*
*/
MergePath
*
create_merge
sort
_path
(
RelOptInfo
*
joinrel
,
create_merge
join
_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_merge
sort
(
outer_path
->
path_cost
,
cost_merge
join
(
outer_path
->
path_cost
,
inner_path
->
path_cost
,
outersortkeys
,
innersortkeys
,
...
...
src/backend/tcop/postgres.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.8
1 1998/07/26 04:30:46 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.8
2 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_merge
sort
_
=
false
;
_enable_merge
join
_
=
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
(
"
\n
POSTGRES backend interactive interface"
);
puts
(
"$Revision: 1.8
1 $ $Date: 1998/07/26 04:30:46
$"
);
puts
(
"$Revision: 1.8
2 $ $Date: 1998/08/04 16:44:20
$"
);
}
/* ----------------
...
...
src/backend/utils/cache/lsyscache.c
View file @
d9be0ff4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.1
5 1998/07/12 21:29:24
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.1
6 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_merge
sort
able -
* op_merge
join
able -
*
* Returns the left and right sort operators and types corresponding to a
* merge
sortable operator, or nil if the operator is not mergesort
able.
* merge
joinable operator, or nil if the operator is not mergejoin
able.
*
*/
bool
op_merge
sort
able
(
Oid
opno
,
Oid
ltype
,
Oid
rtype
,
Oid
*
leftOp
,
Oid
*
rightOp
)
op_merge
join
able
(
Oid
opno
,
Oid
ltype
,
Oid
rtype
,
Oid
*
leftOp
,
Oid
*
rightOp
)
{
FormData_pg_operator
optup
;
...
...
src/include/nodes/plannodes.h
View file @
d9be0ff4
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: plannodes.h,v 1.1
6 1998/07/15 14:54:39
momjian Exp $
* $Id: plannodes.h,v 1.1
7 1998/08/04 16:44:24
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -211,7 +211,7 @@ typedef struct MergeJoin
{
Join
join
;
List
*
mergeclauses
;
Oid
merge
sort
op
;
Oid
merge
join
op
;
Oid
*
mergerightorder
;
/* inner sort operator */
Oid
*
mergeleftorder
;
/* outer sort operator */
MergeJoinState
*
mergestate
;
...
...
src/include/nodes/relation.h
View file @
d9be0ff4
...
...
@@ -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
;
/* merge
sort
only */
MergeOrder
*
merge
sort
order
;
/* merge
join
only */
MergeOrder
*
merge
join
order
;
/* hashjoin only */
Oid
hashjoinoperator
;
...
...
@@ -247,7 +247,7 @@ typedef struct JInfo
NodeTag
type
;
List
*
otherrels
;
List
*
jinfoclauseinfo
;
bool
merge
sort
able
;
bool
merge
join
able
;
bool
hashjoinable
;
bool
inactive
;
}
JInfo
;
...
...
src/include/optimizer/cost.h
View file @
d9be0ff4
...
...
@@ -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_merge
sort
_
;
extern
bool
_enable_merge
join
_
;
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_merge
sort
(
Cost
outercost
,
Cost
innercost
,
cost_merge
join
(
Cost
outercost
,
Cost
innercost
,
List
*
outersortkeys
,
List
*
innersortkeys
,
int
outersize
,
int
innersize
,
int
outerwidth
,
int
innerwidth
);
extern
Cost
...
...
src/include/optimizer/pathnode.h
View file @
d9be0ff4
...
...
@@ -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_merge
sort
_path
(
RelOptInfo
*
joinrel
,
int
outersize
,
create_merge
join
_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
);
...
...
src/include/utils/lsyscache.h
View file @
d9be0ff4
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: lsyscache.h,v 1.1
1 1998/07/12 21:29:40
momjian Exp $
* $Id: lsyscache.h,v 1.1
2 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_merge
sort
able
(
Oid
opid
,
Oid
ltype
,
Oid
rtype
,
op_merge
join
able
(
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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment