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
8d9237d4
Commit
8d9237d4
authored
Feb 03, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizer rename ClauseInfo -> RestrictInfo. Update optimizer README.
parent
f3a6b38e
Changes
34
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
450 additions
and
428 deletions
+450
-428
src/backend/commands/defind.c
src/backend/commands/defind.c
+2
-1
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+12
-12
src/backend/nodes/equalfuncs.c
src/backend/nodes/equalfuncs.c
+26
-33
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+15
-15
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+18
-18
src/backend/optimizer/README
src/backend/optimizer/README
+12
-2
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/geqo/geqo_eval.c
+18
-22
src/backend/optimizer/geqo/geqo_misc.c
src/backend/optimizer/geqo/geqo_misc.c
+3
-3
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/allpaths.c
+6
-7
src/backend/optimizer/path/clausesel.c
src/backend/optimizer/path/clausesel.c
+20
-20
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/costsize.c
+3
-3
src/backend/optimizer/path/hashutils.c
src/backend/optimizer/path/hashutils.c
+9
-9
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/indxpath.c
+66
-66
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinpath.c
+3
-3
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/joinrels.c
+17
-21
src/backend/optimizer/path/mergeutils.c
src/backend/optimizer/path/mergeutils.c
+9
-9
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/path/orindxpath.c
+6
-6
src/backend/optimizer/path/predmig.c
src/backend/optimizer/path/predmig.c
+15
-15
src/backend/optimizer/path/xfunc.c
src/backend/optimizer/path/xfunc.c
+47
-47
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/createplan.c
+7
-7
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/initsplan.c
+30
-30
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/planner.c
+2
-2
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/setrefs.c
+2
-2
src/backend/optimizer/util/clauseinfo.c
src/backend/optimizer/util/clauseinfo.c
+32
-32
src/backend/optimizer/util/indexnode.c
src/backend/optimizer/util/indexnode.c
+2
-2
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
+14
-14
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/relnode.c
+2
-2
src/include/nodes/nodes.h
src/include/nodes/nodes.h
+2
-2
src/include/nodes/relation.h
src/include/nodes/relation.h
+10
-10
src/include/optimizer/cost.h
src/include/optimizer/cost.h
+4
-4
src/include/optimizer/paths.h
src/include/optimizer/paths.h
+4
-4
src/include/optimizer/restrictinfo.h
src/include/optimizer/restrictinfo.h
+27
-0
src/include/optimizer/xfunc.h
src/include/optimizer/xfunc.h
+3
-3
No files found.
src/backend/commands/defind.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.3
1 1999/02/02 03:44:19
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.3
2 1999/02/03 20:15:20
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -20,6 +20,7 @@
#include <access/heapam.h>
#include <utils/builtins.h>
#include <utils/syscache.h>
#include <catalog/heap.h>
#include <catalog/index.h>
#include <catalog/pg_index.h>
#include <catalog/pg_proc.h>
...
...
src/backend/nodes/copyfuncs.c
View file @
8d9237d4
/*-------------------------------------------------------------------------
/*-------------------------------------------------------------------------
*
* copyfuncs.c--
* Copy functions for Postgres tree nodes.
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.5
7 1999/02/02 03:44:26
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.5
8 1999/02/03 20:15:20
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1064,7 +1064,7 @@ _copyRelOptInfo(RelOptInfo * from)
newnode
->
ordering
[
len
]
=
0
;
}
Node_Copy
(
from
,
newnode
,
clause
info
);
Node_Copy
(
from
,
newnode
,
restrict
info
);
Node_Copy
(
from
,
newnode
,
joininfo
);
Node_Copy
(
from
,
newnode
,
innerjoin
);
Node_Copy
(
from
,
newnode
,
superrels
);
...
...
@@ -1119,7 +1119,7 @@ CopyPathFields(Path *from, Path *newnode)
newnode
->
outerjoincost
=
from
->
outerjoincost
;
newnode
->
joinid
=
listCopy
(
from
->
joinid
);
Node_Copy
(
from
,
newnode
,
loc
clause
info
);
Node_Copy
(
from
,
newnode
,
loc
_restrict
info
);
}
/* ----------------
...
...
@@ -1184,7 +1184,7 @@ _copyIndexPath(IndexPath *from)
static
void
CopyJoinPathFields
(
JoinPath
*
from
,
JoinPath
*
newnode
)
{
Node_Copy
(
from
,
newnode
,
path
clause
info
);
Node_Copy
(
from
,
newnode
,
pathinfo
);
Node_Copy
(
from
,
newnode
,
outerjoinpath
);
Node_Copy
(
from
,
newnode
,
innerjoinpath
);
}
...
...
@@ -1324,13 +1324,13 @@ _copyMergeOrder(MergeOrder *from)
}
/* ----------------
* _copy
Clause
Info
* _copy
Restrict
Info
* ----------------
*/
static
Clause
Info
*
_copy
ClauseInfo
(
Clause
Info
*
from
)
static
Restrict
Info
*
_copy
RestrictInfo
(
Restrict
Info
*
from
)
{
ClauseInfo
*
newnode
=
makeNode
(
Clause
Info
);
RestrictInfo
*
newnode
=
makeNode
(
Restrict
Info
);
/* ----------------
* copy remainder of node
...
...
@@ -1430,7 +1430,7 @@ _copyJoinInfo(JoinInfo * from)
* ----------------
*/
newnode
->
otherrels
=
listCopy
(
from
->
otherrels
);
Node_Copy
(
from
,
newnode
,
jinfo
clause
info
);
Node_Copy
(
from
,
newnode
,
jinfo
_restrict
info
);
newnode
->
mergejoinable
=
from
->
mergejoinable
;
newnode
->
hashjoinable
=
from
->
hashjoinable
;
...
...
@@ -1792,8 +1792,8 @@ copyObject(void *from)
case
T_MergeOrder
:
retval
=
_copyMergeOrder
(
from
);
break
;
case
T_
Clause
Info
:
retval
=
_copy
Clause
Info
(
from
);
case
T_
Restrict
Info
:
retval
=
_copy
Restrict
Info
(
from
);
break
;
case
T_JoinMethod
:
retval
=
_copyJoinMethod
(
from
);
...
...
src/backend/nodes/equalfuncs.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.2
1 1999/02/02 23:53:25
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.2
2 1999/02/03 20:15:22
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -278,13 +278,13 @@ _equalFunc(Func *a, Func *b)
}
/*
*
Clause
Info is a subclass of Node.
*
Restrict
Info is a subclass of Node.
*/
static
bool
_equal
ClauseInfo
(
ClauseInfo
*
a
,
Clause
Info
*
b
)
_equal
RestrictInfo
(
RestrictInfo
*
a
,
Restrict
Info
*
b
)
{
Assert
(
IsA
(
a
,
Clause
Info
));
Assert
(
IsA
(
b
,
Clause
Info
));
Assert
(
IsA
(
a
,
Restrict
Info
));
Assert
(
IsA
(
b
,
Restrict
Info
));
if
(
!
equal
(
a
->
clause
,
b
->
clause
))
return
false
;
...
...
@@ -298,8 +298,7 @@ _equalClauseInfo(ClauseInfo * a, ClauseInfo * b)
#endif
if
(
a
->
hashjoinoperator
!=
b
->
hashjoinoperator
)
return
false
;
return
(
equal
((
a
->
indexids
),
(
b
->
indexids
)));
return
equal
(
a
->
indexids
,
b
->
indexids
);
}
/*
...
...
@@ -311,8 +310,7 @@ _equalRelOptInfo(RelOptInfo * a, RelOptInfo * b)
Assert
(
IsA
(
a
,
RelOptInfo
));
Assert
(
IsA
(
b
,
RelOptInfo
));
return
(
equal
((
a
->
relids
),
(
b
->
relids
)));
return
equal
(
a
->
relids
,
b
->
relids
);
}
static
bool
...
...
@@ -321,11 +319,9 @@ _equalJoinMethod(JoinMethod *a, JoinMethod *b)
Assert
(
IsA
(
a
,
JoinMethod
));
Assert
(
IsA
(
b
,
JoinMethod
));
if
(
!
equal
((
a
->
jmkeys
),
(
b
->
jmkeys
)))
if
(
!
equal
(
a
->
jmkeys
,
b
->
jmkeys
))
return
false
;
if
(
!
equal
((
a
->
clauses
),
(
b
->
clauses
)))
if
(
!
equal
(
a
->
clauses
,
b
->
clauses
))
return
false
;
return
true
;
}
...
...
@@ -368,19 +364,16 @@ _equalPath(Path *a, Path *b)
}
else
{
if
(
!
equal
((
a
->
p_ordering
.
ord
.
merge
),
(
b
->
p_ordering
.
ord
.
merge
)))
if
(
!
equal
(
a
->
p_ordering
.
ord
.
merge
,
b
->
p_ordering
.
ord
.
merge
))
return
false
;
}
if
(
!
equal
((
a
->
keys
),
(
b
->
keys
)))
if
(
!
equal
(
a
->
keys
,
b
->
keys
))
return
false
;
/*
* if (a->outerjoincost != b->outerjoincost) return(false);
*/
if
(
!
equali
((
a
->
joinid
),
(
b
->
joinid
)))
if
(
!
equali
(
a
->
joinid
,
b
->
joinid
))
return
false
;
return
true
;
}
...
...
@@ -390,9 +383,9 @@ _equalIndexPath(IndexPath *a, IndexPath *b)
{
if
(
!
_equalPath
((
Path
*
)
a
,
(
Path
*
)
b
))
return
false
;
if
(
!
equali
(
(
a
->
indexid
),
(
b
->
indexid
)
))
if
(
!
equali
(
a
->
indexid
,
b
->
indexid
))
return
false
;
if
(
!
equal
(
(
a
->
indexqual
),
(
b
->
indexqual
)
))
if
(
!
equal
(
a
->
indexqual
,
b
->
indexqual
))
return
false
;
return
true
;
}
...
...
@@ -405,11 +398,11 @@ _equalJoinPath(JoinPath *a, JoinPath *b)
if
(
!
_equalPath
((
Path
*
)
a
,
(
Path
*
)
b
))
return
false
;
if
(
!
equal
(
(
a
->
pathclauseinfo
),
(
b
->
pathclauseinfo
)
))
if
(
!
equal
(
a
->
pathinfo
,
b
->
pathinfo
))
return
false
;
if
(
!
equal
(
(
a
->
outerjoinpath
),
(
b
->
outerjoinpath
)
))
if
(
!
equal
(
a
->
outerjoinpath
,
b
->
outerjoinpath
))
return
false
;
if
(
!
equal
(
(
a
->
innerjoinpath
),
(
b
->
innerjoinpath
)
))
if
(
!
equal
(
a
->
innerjoinpath
,
b
->
innerjoinpath
))
return
false
;
return
true
;
}
...
...
@@ -454,9 +447,9 @@ _equalJoinKey(JoinKey *a, JoinKey *b)
Assert
(
IsA
(
a
,
JoinKey
));
Assert
(
IsA
(
b
,
JoinKey
));
if
(
!
equal
(
(
a
->
outer
),
(
b
->
outer
)
))
if
(
!
equal
(
a
->
outer
,
b
->
outer
))
return
false
;
if
(
!
equal
(
(
a
->
inner
),
(
b
->
inner
)
))
if
(
!
equal
(
a
->
inner
,
b
->
inner
))
return
false
;
return
true
;
}
...
...
@@ -506,13 +499,13 @@ _equalIndexScan(IndexScan *a, IndexScan *b)
* if(a->scan.plan.cost != b->scan.plan.cost) return(false);
*/
if
(
!
equal
(
(
a
->
indxqual
),
(
b
->
indxqual
)
))
if
(
!
equal
(
a
->
indxqual
,
b
->
indxqual
))
return
false
;
if
(
a
->
scan
.
scanrelid
!=
b
->
scan
.
scanrelid
)
return
false
;
if
(
!
equali
(
(
a
->
indxid
),
(
b
->
indxid
)
))
if
(
!
equali
(
a
->
indxid
,
b
->
indxid
))
return
false
;
return
true
;
}
...
...
@@ -523,7 +516,7 @@ _equalSubPlan(SubPlan *a, SubPlan *b)
if
(
a
->
plan_id
!=
b
->
plan_id
)
return
false
;
if
(
!
equal
(
(
a
->
sublink
->
oper
),
(
b
->
sublink
->
oper
)
))
if
(
!
equal
(
a
->
sublink
->
oper
,
b
->
sublink
->
oper
))
return
false
;
return
true
;
...
...
@@ -534,9 +527,9 @@ _equalJoinInfo(JoinInfo * a, JoinInfo * b)
{
Assert
(
IsA
(
a
,
JoinInfo
));
Assert
(
IsA
(
b
,
JoinInfo
));
if
(
!
equal
(
(
a
->
otherrels
),
(
b
->
otherrels
)
))
if
(
!
equal
(
a
->
otherrels
,
b
->
otherrels
))
return
false
;
if
(
!
equal
(
(
a
->
jinfoclauseinfo
),
(
b
->
jinfoclauseinfo
)
))
if
(
!
equal
(
a
->
jinfo_restrictinfo
,
b
->
jinfo_restrictinfo
))
return
false
;
if
(
a
->
mergejoinable
!=
b
->
mergejoinable
)
return
false
;
...
...
@@ -673,8 +666,8 @@ equal(void *a, void *b)
case
T_Func
:
retval
=
_equalFunc
(
a
,
b
);
break
;
case
T_
Clause
Info
:
retval
=
_equal
Clause
Info
(
a
,
b
);
case
T_
Restrict
Info
:
retval
=
_equal
Restrict
Info
(
a
,
b
);
break
;
case
T_RelOptInfo
:
retval
=
_equalRelOptInfo
(
a
,
b
);
...
...
src/backend/nodes/outfuncs.c
View file @
8d9237d4
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: outfuncs.c,v 1.6
2 1999/02/02 03:44:26
momjian Exp $
* $Id: outfuncs.c,v 1.6
3 1999/02/03 20:15:22
momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
...
...
@@ -879,11 +879,11 @@ _outRelOptInfo(StringInfo str, RelOptInfo * node)
*/
appendStringInfo
(
str
,
" :unorderedpath @ 0x%x :cheapestpath @ 0x%x :pruneable %s :
clause
info "
,
" :unorderedpath @ 0x%x :cheapestpath @ 0x%x :pruneable %s :
restrict
info "
,
(
int
)
node
->
unorderedpath
,
(
int
)
node
->
cheapestpath
,
node
->
pruneable
?
"true"
:
"false"
);
_outNode
(
str
,
node
->
clause
info
);
_outNode
(
str
,
node
->
restrict
info
);
appendStringInfo
(
str
,
" :joininfo "
);
_outNode
(
str
,
node
->
joininfo
);
...
...
@@ -967,8 +967,8 @@ _outJoinPath(StringInfo str, JoinPath *node)
node
->
path
.
path_cost
);
_outNode
(
str
,
node
->
path
.
keys
);
appendStringInfo
(
str
,
" :path
clause
info "
);
_outNode
(
str
,
node
->
path
clause
info
);
appendStringInfo
(
str
,
" :pathinfo "
);
_outNode
(
str
,
node
->
pathinfo
);
/*
* Not sure if these are nodes; they're declared as "struct path *".
...
...
@@ -995,8 +995,8 @@ _outMergePath(StringInfo str, MergePath *node)
node
->
jpath
.
path
.
path_cost
);
_outNode
(
str
,
node
->
jpath
.
path
.
keys
);
appendStringInfo
(
str
,
" :path
clause
info "
);
_outNode
(
str
,
node
->
jpath
.
path
clause
info
);
appendStringInfo
(
str
,
" :pathinfo "
);
_outNode
(
str
,
node
->
jpath
.
pathinfo
);
/*
* Not sure if these are nodes; they're declared as "struct path *".
...
...
@@ -1032,8 +1032,8 @@ _outHashPath(StringInfo str, HashPath *node)
node
->
jpath
.
path
.
path_cost
);
_outNode
(
str
,
node
->
jpath
.
path
.
keys
);
appendStringInfo
(
str
,
" :path
clause
info "
);
_outNode
(
str
,
node
->
jpath
.
path
clause
info
);
appendStringInfo
(
str
,
" :pathinfo "
);
_outNode
(
str
,
node
->
jpath
.
pathinfo
);
/*
* Not sure if these are nodes; they're declared as "struct path *".
...
...
@@ -1102,10 +1102,10 @@ _outMergeOrder(StringInfo str, MergeOrder *node)
}
/*
*
Clause
Info is a subclass of Node.
*
Restrict
Info is a subclass of Node.
*/
static
void
_out
ClauseInfo
(
StringInfo
str
,
Clause
Info
*
node
)
_out
RestrictInfo
(
StringInfo
str
,
Restrict
Info
*
node
)
{
appendStringInfo
(
str
,
" CINFO :clause "
);
_outNode
(
str
,
node
->
clause
);
...
...
@@ -1158,8 +1158,8 @@ _outJoinInfo(StringInfo str, JoinInfo * node)
appendStringInfo
(
str
,
" JINFO :otherrels "
);
_outIntList
(
str
,
node
->
otherrels
);
appendStringInfo
(
str
,
" :jinfo
clause
info "
);
_outNode
(
str
,
node
->
jinfo
clause
info
);
appendStringInfo
(
str
,
" :jinfo
_restrict
info "
);
_outNode
(
str
,
node
->
jinfo
_restrict
info
);
appendStringInfo
(
str
,
" :mergejoinable %s :hashjoinable %s "
,
node
->
mergejoinable
?
"true"
:
"false"
,
...
...
@@ -1572,8 +1572,8 @@ _outNode(StringInfo str, void *obj)
case
T_MergeOrder
:
_outMergeOrder
(
str
,
obj
);
break
;
case
T_
Clause
Info
:
_out
Clause
Info
(
str
,
obj
);
case
T_
Restrict
Info
:
_out
Restrict
Info
(
str
,
obj
);
break
;
case
T_JoinMethod
:
_outJoinMethod
(
str
,
obj
);
...
...
src/backend/nodes/readfuncs.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.4
4 1999/02/02 03:44:27
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.4
5 1999/02/03 20:15:22
momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
...
...
@@ -1348,8 +1348,8 @@ _readRelOptInfo()
sscanf
(
token
,
"%x"
,
(
unsigned
int
*
)
&
local_node
->
cheapestpath
);
token
=
lsptok
(
NULL
,
&
length
);
/* get :
clause
info */
local_node
->
clause
info
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :
restrict
info */
local_node
->
restrict
info
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :joininfo */
local_node
->
joininfo
=
nodeRead
(
true
);
/* now read it */
...
...
@@ -1560,8 +1560,8 @@ _readJoinPath()
token
=
lsptok
(
NULL
,
&
length
);
/* get :keys */
local_node
->
path
.
keys
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :path
clause
info */
local_node
->
path
clause
info
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :pathinfo */
local_node
->
pathinfo
=
nodeRead
(
true
);
/* now read it */
/*
* Not sure if these are nodes; they're declared as "struct path *".
...
...
@@ -1628,8 +1628,8 @@ _readMergePath()
token
=
lsptok
(
NULL
,
&
length
);
/* get :keys */
local_node
->
jpath
.
path
.
keys
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :path
clause
info */
local_node
->
jpath
.
path
clause
info
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :pathinfo */
local_node
->
jpath
.
pathinfo
=
nodeRead
(
true
);
/* now read it */
/*
* Not sure if these are nodes; they're declared as "struct path *".
...
...
@@ -1705,8 +1705,8 @@ _readHashPath()
token
=
lsptok
(
NULL
,
&
length
);
/* get :keys */
local_node
->
jpath
.
path
.
keys
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :path
clause
info */
local_node
->
jpath
.
path
clause
info
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :pathinfo */
local_node
->
jpath
.
pathinfo
=
nodeRead
(
true
);
/* now read it */
/*
* Not sure if these are nodes; they're declared as "struct path *".
...
...
@@ -1844,19 +1844,19 @@ _readMergeOrder()
}
/* ----------------
* _read
Clause
Info
* _read
Restrict
Info
*
*
Clause
Info is a subclass of Node.
*
Restrict
Info is a subclass of Node.
* ----------------
*/
static
Clause
Info
*
_read
Clause
Info
()
static
Restrict
Info
*
_read
Restrict
Info
()
{
Clause
Info
*
local_node
;
Restrict
Info
*
local_node
;
char
*
token
;
int
length
;
local_node
=
makeNode
(
Clause
Info
);
local_node
=
makeNode
(
Restrict
Info
);
token
=
lsptok
(
NULL
,
&
length
);
/* get :clause */
local_node
->
clause
=
nodeRead
(
true
);
/* now read it */
...
...
@@ -1960,8 +1960,8 @@ _readJoinInfo()
local_node
->
otherrels
=
toIntList
(
nodeRead
(
true
));
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :jinfo
clause
info */
local_node
->
jinfo
clause
info
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :jinfo
_restrict
info */
local_node
->
jinfo
_restrict
info
=
nodeRead
(
true
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :mergejoinable */
...
...
@@ -2096,7 +2096,7 @@ parsePlanString(void)
else
if
(
!
strncmp
(
token
,
"MERGEORDER"
,
length
))
return_value
=
_readMergeOrder
();
else
if
(
!
strncmp
(
token
,
"CLAUSEINFO"
,
length
))
return_value
=
_read
Clause
Info
();
return_value
=
_read
Restrict
Info
();
else
if
(
!
strncmp
(
token
,
"JOINMETHOD"
,
length
))
return_value
=
_readJoinMethod
();
else
if
(
!
strncmp
(
token
,
"JOININFO"
,
length
))
...
...
src/backend/optimizer/README
View file @
8d9237d4
Thse directories take the Query structure returned by the parser, and
Th
e
se directories take the Query structure returned by the parser, and
generate a plan used by the executor. The /plan directory generates the
plan, the /path generates all possible ways to join the tables, and
/prep handles special cases like inheritance. /utils is utility stuff.
...
...
@@ -81,10 +81,20 @@ planner()
remove from the join list the relation we just added to each join
prune_rel_paths()
set cheapest and perhaps remove unordered path, recompute table sizes
if we have not done all the tables, go to
"again"
if we have not done all the tables, go to
again:
do group(GROUP)
do aggregate
put back constants
re-flatten target list
make unique(DISTINCT)
make sort(ORDER BY)
Optimizer Structures
--------------------
Path - info about every way to access a relation(sequential, index)
PathOrder - info about every ordering (sort, merge of relations)
RelOptInfo - info about every relation
JoinInfo - info about join combinations
RestrictInfo - info about restrictions
src/backend/optimizer/geqo/geqo_eval.c
View file @
8d9237d4
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_eval.c,v 1.2
4 1998/09/01 04:29:16
momjian Exp $
* $Id: geqo_eval.c,v 1.2
5 1999/02/03 20:15:24
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -290,7 +290,7 @@ init_join_rel(RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * joininf
joinrel
->
classlist
=
NULL
;
joinrel
->
relam
=
InvalidOid
;
joinrel
->
ordering
=
NULL
;
joinrel
->
clause
info
=
NIL
;
joinrel
->
restrict
info
=
NIL
;
joinrel
->
joininfo
=
NULL
;
joinrel
->
innerjoin
=
NIL
;
joinrel
->
superrels
=
NIL
;
...
...
@@ -302,7 +302,7 @@ init_join_rel(RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * joininf
if
(
joininfo
)
{
joinrel
->
clauseinfo
=
joininfo
->
jinfoclause
info
;
joinrel
->
restrictinfo
=
joininfo
->
jinfo_restrict
info
;
if
(
BushyPlanFlag
)
joininfo
->
inactive
=
true
;
}
...
...
@@ -410,22 +410,18 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
current_joininfo_list
);
if
(
other_joininfo
)
{
other_joininfo
->
jinfo
clause
info
=
(
List
*
)
LispUnion
(
joininfo
->
jinfo
clause
info
,
other_joininfo
->
jinfo
clause
info
);
other_joininfo
->
jinfo
_restrict
info
=
(
List
*
)
LispUnion
(
joininfo
->
jinfo
_restrict
info
,
other_joininfo
->
jinfo
_restrict
info
);
}
else
{
other_joininfo
=
makeNode
(
JoinInfo
);
other_joininfo
->
otherrels
=
joininfo
->
otherrels
;
other_joininfo
->
jinfoclauseinfo
=
joininfo
->
jinfoclauseinfo
;
other_joininfo
->
mergejoinable
=
joininfo
->
mergejoinable
;
other_joininfo
->
hashjoinable
=
joininfo
->
hashjoinable
;
other_joininfo
->
otherrels
=
joininfo
->
otherrels
;
other_joininfo
->
jinfo_restrictinfo
=
joininfo
->
jinfo_restrictinfo
;
other_joininfo
->
mergejoinable
=
joininfo
->
mergejoinable
;
other_joininfo
->
hashjoinable
=
joininfo
->
hashjoinable
;
other_joininfo
->
inactive
=
false
;
current_joininfo_list
=
lcons
(
other_joininfo
,
...
...
@@ -508,7 +504,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
{
JoinInfo
*
joininfo
=
(
JoinInfo
*
)
lfirst
(
xjoininfo
);
List
*
other_rels
=
joininfo
->
otherrels
;
List
*
clause_info
=
joininfo
->
jinfoclause
info
;
List
*
restrict_info
=
joininfo
->
jinfo_restrict
info
;
bool
mergejoinable
=
joininfo
->
mergejoinable
;
bool
hashjoinable
=
joininfo
->
hashjoinable
;
...
...
@@ -540,7 +536,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
new_joininfo
=
makeNode
(
JoinInfo
);
new_joininfo
->
otherrels
=
joinrel
->
relids
;
new_joininfo
->
jinfo
clauseinfo
=
clause
_info
;
new_joininfo
->
jinfo
_restrictinfo
=
restrict
_info
;
new_joininfo
->
mergejoinable
=
mergejoinable
;
new_joininfo
->
hashjoinable
=
hashjoinable
;
new_joininfo
->
inactive
=
false
;
...
...
@@ -560,16 +556,16 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
if
(
other_joininfo
)
{
other_joininfo
->
jinfo
clause
info
=
(
List
*
)
LispUnion
(
clause
_info
,
other_joininfo
->
jinfo
clause
info
);
other_joininfo
->
jinfo
_restrict
info
=
(
List
*
)
LispUnion
(
restrict
_info
,
other_joininfo
->
jinfo
_restrict
info
);
}
else
{
JoinInfo
*
new_joininfo
=
makeNode
(
JoinInfo
);
new_joininfo
->
otherrels
=
new_relids
;
new_joininfo
->
jinfo
clauseinfo
=
clause
_info
;
new_joininfo
->
jinfo
_restrictinfo
=
restrict
_info
;
new_joininfo
->
mergejoinable
=
mergejoinable
;
new_joininfo
->
hashjoinable
=
hashjoinable
;
new_joininfo
->
inactive
=
false
;
...
...
@@ -695,8 +691,8 @@ geqo_joinrel_size(RelOptInfo * joinrel, RelOptInfo * outer_rel, RelOptInfo * inn
temp
=
(
Cost
)
inner_rel
->
tuples
*
(
Cost
)
outer_rel
->
tuples
;
/* cartesian product */
if
(
joinrel
->
clause
info
)
temp
=
temp
*
product_selec
(
joinrel
->
clause
info
);
if
(
joinrel
->
restrict
info
)
temp
=
temp
*
product_selec
(
joinrel
->
restrict
info
);
if
(
temp
>=
(
MAXINT
-
1
))
ntuples
=
ceil
(
geqo_log
((
double
)
temp
,
(
double
)
GEQO_LOG_BASE
));
...
...
src/backend/optimizer/geqo/geqo_misc.c
View file @
8d9237d4
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_misc.c,v 1.1
1 1998/09/01 04:29:19
momjian Exp $
* $Id: geqo_misc.c,v 1.1
2 1999/02/03 20:15:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -146,7 +146,7 @@ geqo_print_joinclauses(Query *root, List *clauses)
foreach
(
l
,
clauses
)
{
Clause
Info
*
c
=
lfirst
(
l
);
Restrict
Info
*
c
=
lfirst
(
l
);
print_expr
((
Node
*
)
c
->
clause
,
root
->
rtable
);
if
(
lnext
(
l
))
...
...
@@ -204,7 +204,7 @@ geqo_print_path(Query *root, Path *path, int indent)
printf
(
"
\t
"
);
printf
(
" clauses=("
);
geqo_print_joinclauses
(
root
,
((
JoinPath
*
)
path
)
->
path
clause
info
);
((
JoinPath
*
)
path
)
->
pathinfo
);
printf
(
")
\n
"
);
if
(
nodeTag
(
path
)
==
T_MergePath
)
...
...
src/backend/optimizer/path/allpaths.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.2
4 1999/02/02 20:30:05
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.2
5 1999/02/03 20:15:28
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -122,10 +122,10 @@ find_rel_paths(Query *root, List *rels)
rel_index_scan_list
=
find_index_paths
(
root
,
rel
,
find_relation_indices
(
root
,
rel
),
rel
->
clause
info
,
rel
->
restrict
info
,
rel
->
joininfo
);
or_index_scan_list
=
create_or_index_paths
(
root
,
rel
,
rel
->
clause
info
);
or_index_scan_list
=
create_or_index_paths
(
root
,
rel
,
rel
->
restrict
info
);
rel
->
pathlist
=
add_pathlist
(
rel
,
sequential_scan_list
,
...
...
@@ -145,7 +145,7 @@ find_rel_paths(Query *root, List *rels)
* if there is a qualification of sequential scan the selec. value
* is not set -- so set it explicitly -- Sunita
*/
set_rest_selec
(
root
,
rel
->
clause
info
);
set_rest_selec
(
root
,
rel
->
restrict
info
);
rel
->
size
=
compute_rel_size
(
rel
);
rel
->
width
=
compute_rel_width
(
rel
);
}
...
...
@@ -290,7 +290,7 @@ print_joinclauses(Query *root, List *clauses)
foreach
(
l
,
clauses
)
{
Clause
Info
*
c
=
lfirst
(
l
);
Restrict
Info
*
c
=
lfirst
(
l
);
print_expr
((
Node
*
)
c
->
clause
,
root
->
rtable
);
if
(
lnext
(
l
))
...
...
@@ -347,8 +347,7 @@ print_path(Query *root, Path *path, int indent)
for
(
i
=
0
;
i
<
indent
+
1
;
i
++
)
printf
(
"
\t
"
);
printf
(
" clauses=("
);
print_joinclauses
(
root
,
((
JoinPath
*
)
path
)
->
pathclauseinfo
);
print_joinclauses
(
root
,
((
JoinPath
*
)
path
)
->
pathinfo
);
printf
(
")
\n
"
);
if
(
nodeTag
(
path
)
==
T_MergePath
)
...
...
src/backend/optimizer/path/clausesel.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.1
4 1998/11/09 02:49:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.1
5 1999/02/03 20:15:28
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -19,7 +19,7 @@
#include "nodes/primnodes.h"
#include "nodes/relation.h"
#include "optimizer/clauses.h"
#include "optimizer/
clause
info.h"
#include "optimizer/
restrict
info.h"
#include "optimizer/cost.h"
#include "optimizer/internal.h"
#include "optimizer/plancat.h"
...
...
@@ -35,7 +35,7 @@ static Cost compute_selec(Query *root, List *clauses, List *or_selectivities);
/*
* set_clause_selectivities -
* Sets the selectivity field for each of clause in '
clause
info-list'
* Sets the selectivity field for each of clause in '
restrict
info-list'
* to 'new-selectivity'. If the selectivity has already been set, reset
* it only if the new one is better.
*
...
...
@@ -43,15 +43,15 @@ static Cost compute_selec(Query *root, List *clauses, List *or_selectivities);
*
*/
void
set_clause_selectivities
(
List
*
clause
info_list
,
Cost
new_selectivity
)
set_clause_selectivities
(
List
*
restrict
info_list
,
Cost
new_selectivity
)
{
List
*
temp
;
Clause
Info
*
clausenode
;
Restrict
Info
*
clausenode
;
Cost
cost_clause
;
foreach
(
temp
,
clause
info_list
)
foreach
(
temp
,
restrict
info_list
)
{
clausenode
=
(
Clause
Info
*
)
lfirst
(
temp
);
clausenode
=
(
Restrict
Info
*
)
lfirst
(
temp
);
cost_clause
=
clausenode
->
selectivity
;
if
(
FLOAT_IS_ZERO
(
cost_clause
)
||
new_selectivity
<
cost_clause
)
clausenode
->
selectivity
=
new_selectivity
;
...
...
@@ -60,23 +60,23 @@ set_clause_selectivities(List *clauseinfo_list, Cost new_selectivity)
/*
* product_selec -
* Multiplies the selectivities of each clause in '
clause
info-list'.
* Multiplies the selectivities of each clause in '
restrict
info-list'.
*
* Returns a flonum corresponding to the selectivity of '
clause
info-list'.
* Returns a flonum corresponding to the selectivity of '
restrict
info-list'.
*/
Cost
product_selec
(
List
*
clause
info_list
)
product_selec
(
List
*
restrict
info_list
)
{
Cost
result
=
1
.
0
;
if
(
clause
info_list
!=
NIL
)
if
(
restrict
info_list
!=
NIL
)
{
List
*
xclausenode
=
NIL
;
Cost
temp
;
foreach
(
xclausenode
,
clause
info_list
)
foreach
(
xclausenode
,
restrict
info_list
)
{
temp
=
((
Clause
Info
*
)
lfirst
(
xclausenode
))
->
selectivity
;
temp
=
((
Restrict
Info
*
)
lfirst
(
xclausenode
))
->
selectivity
;
result
=
result
*
temp
;
}
}
...
...
@@ -89,7 +89,7 @@ product_selec(List *clauseinfo_list)
* those clauses that haven't been assigned a selectivity by an index.
*
* Returns nothing of interest.
* MODIFIES: selectivities of the various rel's
clause
info
* MODIFIES: selectivities of the various rel's
restrict
info
* slots.
*/
void
...
...
@@ -101,28 +101,28 @@ set_rest_relselec(Query *root, List *rel_list)
foreach
(
x
,
rel_list
)
{
rel
=
(
RelOptInfo
*
)
lfirst
(
x
);
set_rest_selec
(
root
,
rel
->
clause
info
);
set_rest_selec
(
root
,
rel
->
restrict
info
);
}
}
/*
* set_rest_selec -
* Sets the selectivity fields for those clauses within a single
* relation's '
clause
info-list' that haven't already been set.
* relation's '
restrict
info-list' that haven't already been set.
*
* Returns nothing of interest.
*
*/
void
set_rest_selec
(
Query
*
root
,
List
*
clause
info_list
)
set_rest_selec
(
Query
*
root
,
List
*
restrict
info_list
)
{
List
*
temp
=
NIL
;
ClauseInfo
*
clausenode
=
(
Clause
Info
*
)
NULL
;
RestrictInfo
*
clausenode
=
(
Restrict
Info
*
)
NULL
;
Cost
cost_clause
;
foreach
(
temp
,
clause
info_list
)
foreach
(
temp
,
restrict
info_list
)
{
clausenode
=
(
Clause
Info
*
)
lfirst
(
temp
);
clausenode
=
(
Restrict
Info
*
)
lfirst
(
temp
);
cost_clause
=
clausenode
->
selectivity
;
/*
...
...
src/backend/optimizer/path/costsize.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.2
5 1998/09/01 04:29:30
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.2
6 1999/02/03 20:15:32
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -365,7 +365,7 @@ compute_rel_size(RelOptInfo * rel)
Cost
temp
;
int
temp1
;
temp
=
rel
->
tuples
*
product_selec
(
rel
->
clause
info
);
temp
=
rel
->
tuples
*
product_selec
(
rel
->
restrict
info
);
Assert
(
temp
>=
0
);
if
(
temp
>=
(
MAXINT
-
1
))
temp1
=
MAXINT
;
...
...
@@ -443,7 +443,7 @@ compute_joinrel_size(JoinPath *joinpath)
temp
*=
((
Path
*
)
joinpath
->
outerjoinpath
)
->
parent
->
size
;
temp
*=
((
Path
*
)
joinpath
->
innerjoinpath
)
->
parent
->
size
;
temp
=
temp
*
product_selec
(
joinpath
->
path
clause
info
);
temp
=
temp
*
product_selec
(
joinpath
->
pathinfo
);
if
(
temp
>=
(
MAXINT
-
1
))
temp1
=
MAXINT
;
else
...
...
src/backend/optimizer/path/hashutils.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.
7 1998/09/01 04:29
:32 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/hashutils.c,v 1.
8 1999/02/03 20:15
:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -24,29 +24,29 @@ static HInfo *match_hashop_hashinfo(Oid hashop, List *hashinfo_list);
/*
* group-clauses-by-hashop--
* If a join clause node in '
clause
info-list' is hashjoinable, store
* If a join clause node in '
restrict
info-list' is hashjoinable, store
* it within a hashinfo node containing other clause nodes with the same
* hash operator.
*
* '
clauseinfo-list' is the list of clause
info nodes
* '
restrictinfo-list' is the list of restrict
info nodes
* 'inner-relid' is the relid of the inner join relation
*
* Returns the new list of hashinfo nodes.
*
*/
List
*
group_clauses_by_hashop
(
List
*
clause
info_list
,
group_clauses_by_hashop
(
List
*
restrict
info_list
,
int
inner_relid
)
{
List
*
hashinfo_list
=
NIL
;
ClauseInfo
*
clauseinfo
=
(
Clause
Info
*
)
NULL
;
RestrictInfo
*
restrictinfo
=
(
Restrict
Info
*
)
NULL
;
List
*
i
=
NIL
;
Oid
hashjoinop
=
0
;
foreach
(
i
,
clause
info_list
)
foreach
(
i
,
restrict
info_list
)
{
clauseinfo
=
(
Clause
Info
*
)
lfirst
(
i
);
hashjoinop
=
clause
info
->
hashjoinoperator
;
restrictinfo
=
(
Restrict
Info
*
)
lfirst
(
i
);
hashjoinop
=
restrict
info
->
hashjoinoperator
;
/*
* Create a new hashinfo node and add it to 'hashinfo-list' if one
...
...
@@ -55,7 +55,7 @@ group_clauses_by_hashop(List *clauseinfo_list,
if
(
hashjoinop
)
{
HInfo
*
xhashinfo
=
(
HInfo
*
)
NULL
;
Expr
*
clause
=
clause
info
->
clause
;
Expr
*
clause
=
restrict
info
->
clause
;
Var
*
leftop
=
get_leftop
(
clause
);
Var
*
rightop
=
get_rightop
(
clause
);
JoinKey
*
keys
=
(
JoinKey
*
)
NULL
;
...
...
src/backend/optimizer/path/indxpath.c
View file @
8d9237d4
This diff is collapsed.
Click to expand it.
src/backend/optimizer/path/joinpath.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.1
0 1998/09/01 04:29:35
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.1
1 1999/02/03 20:15:33
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -97,14 +97,14 @@ find_all_join_paths(Query *root, List *joinrels)
if
(
_enable_mergejoin_
)
{
mergeinfo_list
=
group_clauses_by_order
(
joinrel
->
clause
info
,
group_clauses_by_order
(
joinrel
->
restrict
info
,
lfirsti
(
innerrel
->
relids
));
}
if
(
_enable_hashjoin_
)
{
hashinfo_list
=
group_clauses_by_hashop
(
joinrel
->
clause
info
,
group_clauses_by_hashop
(
joinrel
->
restrict
info
,
lfirsti
(
innerrel
->
relids
));
}
...
...
src/backend/optimizer/path/joinrels.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.1
5 1998/09/01 04:29:37
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.1
6 1999/02/03 20:15:33
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -224,7 +224,7 @@ init_join_rel(RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * joininf
joinrel
->
classlist
=
NULL
;
joinrel
->
relam
=
InvalidOid
;
joinrel
->
ordering
=
NULL
;
joinrel
->
clause
info
=
NIL
;
joinrel
->
restrict
info
=
NIL
;
joinrel
->
joininfo
=
NULL
;
joinrel
->
innerjoin
=
NIL
;
joinrel
->
superrels
=
NIL
;
...
...
@@ -238,7 +238,7 @@ init_join_rel(RelOptInfo * outer_rel, RelOptInfo * inner_rel, JoinInfo * joininf
if
(
joininfo
)
{
joinrel
->
clauseinfo
=
joininfo
->
jinfoclause
info
;
joinrel
->
restrictinfo
=
joininfo
->
jinfo_restrict
info
;
if
(
BushyPlanFlag
)
joininfo
->
inactive
=
true
;
}
...
...
@@ -346,22 +346,18 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
current_joininfo_list
);
if
(
other_joininfo
)
{
other_joininfo
->
jinfo
clause
info
=
(
List
*
)
LispUnion
(
joininfo
->
jinfo
clause
info
,
other_joininfo
->
jinfo
clause
info
);
other_joininfo
->
jinfo
_restrict
info
=
(
List
*
)
LispUnion
(
joininfo
->
jinfo
_restrict
info
,
other_joininfo
->
jinfo
_restrict
info
);
}
else
{
other_joininfo
=
makeNode
(
JoinInfo
);
other_joininfo
->
otherrels
=
joininfo
->
otherrels
;
other_joininfo
->
jinfoclauseinfo
=
joininfo
->
jinfoclauseinfo
;
other_joininfo
->
mergejoinable
=
joininfo
->
mergejoinable
;
other_joininfo
->
hashjoinable
=
joininfo
->
hashjoinable
;
other_joininfo
->
otherrels
=
joininfo
->
otherrels
;
other_joininfo
->
jinfo_restrictinfo
=
joininfo
->
jinfo_restrictinfo
;
other_joininfo
->
mergejoinable
=
joininfo
->
mergejoinable
;
other_joininfo
->
hashjoinable
=
joininfo
->
hashjoinable
;
other_joininfo
->
inactive
=
false
;
current_joininfo_list
=
lcons
(
other_joininfo
,
...
...
@@ -412,7 +408,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
{
JoinInfo
*
joininfo
=
(
JoinInfo
*
)
lfirst
(
xjoininfo
);
List
*
other_rels
=
joininfo
->
otherrels
;
List
*
clause_info
=
joininfo
->
jinfoclause
info
;
List
*
restrict_info
=
joininfo
->
jinfo_restrict
info
;
bool
mergejoinable
=
joininfo
->
mergejoinable
;
bool
hashjoinable
=
joininfo
->
hashjoinable
;
...
...
@@ -425,7 +421,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
JoinInfo
*
new_joininfo
=
makeNode
(
JoinInfo
);
new_joininfo
->
otherrels
=
joinrel
->
relids
;
new_joininfo
->
jinfo
clauseinfo
=
clause
_info
;
new_joininfo
->
jinfo
_restrictinfo
=
restrict
_info
;
new_joininfo
->
mergejoinable
=
mergejoinable
;
new_joininfo
->
hashjoinable
=
hashjoinable
;
new_joininfo
->
inactive
=
false
;
...
...
@@ -445,16 +441,16 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
if
(
other_joininfo
)
{
other_joininfo
->
jinfo
clause
info
=
(
List
*
)
LispUnion
(
clause
_info
,
other_joininfo
->
jinfo
clause
info
);
other_joininfo
->
jinfo
_restrict
info
=
(
List
*
)
LispUnion
(
restrict
_info
,
other_joininfo
->
jinfo
_restrict
info
);
}
else
{
JoinInfo
*
new_joininfo
=
makeNode
(
JoinInfo
);
new_joininfo
->
otherrels
=
new_relids
;
new_joininfo
->
jinfo
clauseinfo
=
clause
_info
;
new_joininfo
->
jinfo
_restrictinfo
=
restrict
_info
;
new_joininfo
->
mergejoinable
=
mergejoinable
;
new_joininfo
->
hashjoinable
=
hashjoinable
;
new_joininfo
->
inactive
=
false
;
...
...
@@ -583,7 +579,7 @@ set_joinrel_size(RelOptInfo * joinrel, RelOptInfo * outer_rel, RelOptInfo * inne
}
else
{
selec
=
product_selec
(
jinfo
->
jinfo
clause
info
);
selec
=
product_selec
(
jinfo
->
jinfo
_restrict
info
);
/* ntuples = Min(outer_rel->tuples,inner_rel->tuples) * selec; */
ntuples
=
outer_rel
->
tuples
*
inner_rel
->
tuples
*
selec
;
}
...
...
src/backend/optimizer/path/mergeutils.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.
9 1998/09/01 04:29:40
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/mergeutils.c,v 1.
10 1999/02/03 20:15:33
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -23,27 +23,27 @@
/*
* group-clauses-by-order--
* If a join clause node in '
clause
info-list' is mergejoinable, store
* If a join clause node in '
restrict
info-list' is mergejoinable, store
* it within a mergeinfo node containing other clause nodes with the same
* mergejoin ordering.
*
* '
clauseinfo-list' is the list of clause
info nodes
* '
restrictinfo-list' is the list of restrict
info nodes
* 'inner-relid' is the relid of the inner join relation
*
* Returns the new list of mergeinfo nodes.
*
*/
List
*
group_clauses_by_order
(
List
*
clause
info_list
,
group_clauses_by_order
(
List
*
restrict
info_list
,
int
inner_relid
)
{
List
*
mergeinfo_list
=
NIL
;
List
*
x
clause
info
=
NIL
;
List
*
x
restrict
info
=
NIL
;
foreach
(
x
clauseinfo
,
clause
info_list
)
foreach
(
x
restrictinfo
,
restrict
info_list
)
{
ClauseInfo
*
clauseinfo
=
(
ClauseInfo
*
)
lfirst
(
xclause
info
);
MergeOrder
*
merge_ordering
=
clause
info
->
mergejoinorder
;
RestrictInfo
*
restrictinfo
=
(
RestrictInfo
*
)
lfirst
(
xrestrict
info
);
MergeOrder
*
merge_ordering
=
restrict
info
->
mergejoinorder
;
if
(
merge_ordering
)
{
...
...
@@ -54,7 +54,7 @@ group_clauses_by_order(List *clauseinfo_list,
*/
PathOrder
p_ordering
;
MInfo
*
xmergeinfo
;
Expr
*
clause
=
clause
info
->
clause
;
Expr
*
clause
=
restrict
info
->
clause
;
Var
*
leftop
=
get_leftop
(
clause
);
Var
*
rightop
=
get_rightop
(
clause
);
JoinKey
*
keys
;
...
...
src/backend/optimizer/path/orindxpath.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.1
2 1998/09/21 15:41:27
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.1
3 1999/02/03 20:15:33
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -22,7 +22,7 @@
#include "optimizer/internal.h"
#include "optimizer/clauses.h"
#include "optimizer/
clause
info.h"
#include "optimizer/
restrict
info.h"
#include "optimizer/paths.h"
#include "optimizer/cost.h"
#include "optimizer/plancat.h"
...
...
@@ -58,7 +58,7 @@ create_or_index_paths(Query *root,
foreach
(
clist
,
clauses
)
{
ClauseInfo
*
clausenode
=
(
Clause
Info
*
)
(
lfirst
(
clist
));
RestrictInfo
*
clausenode
=
(
Restrict
Info
*
)
(
lfirst
(
clist
));
/*
* Check to see if this clause is an 'or' clause, and, if so,
...
...
@@ -118,11 +118,11 @@ create_or_index_paths(Query *root,
pathnode
->
path
.
path_cost
=
cost
;
/*
* copy
clause
info list into path for expensive function
* copy
restrict
info list into path for expensive function
* processing -- JMH, 7/7/92
*/
pathnode
->
path
.
loc
clause
info
=
set_difference
(
copyObject
((
Node
*
)
rel
->
clause
info
),
pathnode
->
path
.
loc
_restrict
info
=
set_difference
(
copyObject
((
Node
*
)
rel
->
restrict
info
),
lcons
(
clausenode
,
NIL
));
#if 0 /* fix xfunc */
...
...
src/backend/optimizer/path/predmig.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.1
3 1998/09/01 04:29:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/predmig.c,v 1.1
4 1999/02/03 20:15:34
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -64,7 +64,7 @@ static void xfunc_form_groups(Stream root, Stream bottom);
static
void
xfunc_free_stream
(
Stream
root
);
static
Stream
xfunc_add_clauses
(
Stream
current
);
static
void
xfunc_setup_group
(
Stream
node
,
Stream
bottom
);
static
Stream
xfunc_streaminsert
(
ClauseInfo
clause
info
,
Stream
current
,
static
Stream
xfunc_streaminsert
(
RestrictInfo
restrict
info
,
Stream
current
,
int
clausetype
);
static
int
xfunc_num_relids
(
Stream
node
);
static
StreamPtr
xfunc_get_downjoin
(
Stream
node
);
...
...
@@ -142,7 +142,7 @@ xfunc_predmig(JoinPath pathnode,/* root of the join tree */
set_downstream
(
laststream
,
(
StreamPtr
)
newstream
);
set_downstream
(
newstream
,
(
StreamPtr
)
NULL
);
set_pathptr
(
newstream
,
(
pathPtr
)
pathnode
);
set_cinfo
(
newstream
,
(
Clause
Info
)
NULL
);
set_cinfo
(
newstream
,
(
Restrict
Info
)
NULL
);
set_clausetype
(
newstream
,
XFUNC_UNKNOWN
);
/* base case: we're at a leaf, call xfunc_series_llel */
...
...
@@ -315,7 +315,7 @@ xfunc_complete_stream(Stream stream)
static
bool
xfunc_prdmig_pullup
(
Stream
origstream
,
Stream
pullme
,
JoinPath
joinpath
)
{
ClauseInfo
clause
info
=
get_cinfo
(
pullme
);
RestrictInfo
restrict
info
=
get_cinfo
(
pullme
);
bool
progress
=
false
;
Stream
upjoin
,
orignode
,
...
...
@@ -325,7 +325,7 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
/* find node in origstream that contains clause */
for
(
orignode
=
origstream
;
orignode
!=
(
Stream
)
NULL
&&
get_cinfo
(
orignode
)
!=
clause
info
;
&&
get_cinfo
(
orignode
)
!=
restrict
info
;
orignode
=
(
Stream
)
get_downstream
(
orignode
))
/* empty body in for loop */
;
if
(
!
orignode
)
...
...
@@ -348,13 +348,13 @@ xfunc_prdmig_pullup(Stream origstream, Stream pullme, JoinPath joinpath)
whichchild
=
OUTER
;
else
whichchild
=
INNER
;
clause
info
=
xfunc_pullup
((
Path
)
get_pathptr
((
Stream
)
get_downstream
(
upjoin
)),
restrict
info
=
xfunc_pullup
((
Path
)
get_pathptr
((
Stream
)
get_downstream
(
upjoin
)),
(
JoinPath
)
get_pathptr
(
upjoin
),
clause
info
,
restrict
info
,
whichchild
,
get_clausetype
(
orignode
));
set_pathptr
(
pullme
,
get_pathptr
(
upjoin
));
/* pullme has been moved into loc
clause
info */
/* pullme has been moved into loc
restrict
info */
set_clausetype
(
pullme
,
XFUNC_LOCPRD
);
/*
...
...
@@ -524,10 +524,10 @@ xfunc_add_clauses(Stream current)
LispValue
primjoin
;
/* first add in the local clauses */
foreach
(
temp
,
get_loc
clause
info
((
Path
)
get_pathptr
(
current
)))
foreach
(
temp
,
get_loc
_restrict
info
((
Path
)
get_pathptr
(
current
)))
{
topnode
=
xfunc_streaminsert
((
Clause
Info
)
lfirst
(
temp
),
topnode
,
xfunc_streaminsert
((
Restrict
Info
)
lfirst
(
temp
),
topnode
,
XFUNC_LOCPRD
);
}
...
...
@@ -535,11 +535,11 @@ xfunc_add_clauses(Stream current)
if
(
IsA
(
get_pathptr
(
current
),
JoinPath
))
{
primjoin
=
xfunc_primary_join
((
JoinPath
)
get_pathptr
(
current
));
foreach
(
temp
,
get_path
clause
info
((
JoinPath
)
get_pathptr
(
current
)))
foreach
(
temp
,
get_path
restrict
info
((
JoinPath
)
get_pathptr
(
current
)))
{
if
(
!
equal
(
get_clause
((
Clause
Info
)
lfirst
(
temp
)),
primjoin
))
if
(
!
equal
(
get_clause
((
Restrict
Info
)
lfirst
(
temp
)),
primjoin
))
topnode
=
xfunc_streaminsert
((
Clause
Info
)
lfirst
(
temp
),
topnode
,
xfunc_streaminsert
((
Restrict
Info
)
lfirst
(
temp
),
topnode
,
XFUNC_JOINPRD
);
}
}
...
...
@@ -593,7 +593,7 @@ xfunc_setup_group(Stream node, Stream bottom)
** Return new node.
*/
static
Stream
xfunc_streaminsert
(
ClauseInfo
clause
info
,
xfunc_streaminsert
(
RestrictInfo
restrict
info
,
Stream
current
,
int
clausetype
)
/* XFUNC_LOCPRD or XFUNC_JOINPRD */
{
...
...
@@ -605,7 +605,7 @@ xfunc_streaminsert(ClauseInfo clauseinfo,
set_upstream
(
current
,
(
StreamPtr
)
newstream
);
set_downstream
(
newstream
,
(
StreamPtr
)
current
);
set_pathptr
(
newstream
,
get_pathptr
(
current
));
set_cinfo
(
newstream
,
clause
info
);
set_cinfo
(
newstream
,
restrict
info
);
set_clausetype
(
newstream
,
clausetype
);
return
newstream
;
}
...
...
src/backend/optimizer/path/xfunc.c
View file @
8d9237d4
This diff is collapsed.
Click to expand it.
src/backend/optimizer/plan/createplan.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.3
4 1998/12/04 15:34:05 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.3
5 1999/02/03 20:15:37 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -31,7 +31,7 @@
#include "utils/palloc.h"
#include "utils/builtins.h"
#include "optimizer/
clause
info.h"
#include "optimizer/
restrict
info.h"
#include "optimizer/clauses.h"
#include "optimizer/planmain.h"
#include "optimizer/tlist.h"
...
...
@@ -170,7 +170,7 @@ create_scan_node(Path *best_path, List *tlist)
* xfunc_trypullup(), we get the relevant clauses from the path
* itself, not its parent relation. --- JMH, 6/15/92
*/
scan_clauses
=
fix_opids
(
get_actual_clauses
(
best_path
->
loc
clause
info
));
scan_clauses
=
fix_opids
(
get_actual_clauses
(
best_path
->
loc
_restrict
info
));
switch
(
best_path
->
pathtype
)
{
...
...
@@ -219,7 +219,7 @@ create_join_node(JoinPath *best_path, List *tlist)
inner_node
=
create_plan
((
Path
*
)
best_path
->
innerjoinpath
);
inner_tlist
=
inner_node
->
targetlist
;
clauses
=
get_actual_clauses
(
best_path
->
path
clause
info
);
clauses
=
get_actual_clauses
(
best_path
->
pathinfo
);
switch
(
best_path
->
path
.
pathtype
)
{
...
...
@@ -263,11 +263,11 @@ create_join_node(JoinPath *best_path, List *tlist)
* into this path node. Put them in the qpqual of the plan node. * --
* JMH, 6/15/92
*/
if (get_loc
clause
info(best_path) != NIL)
if (get_loc
_restrict
info(best_path) != NIL)
set_qpqual((Plan) retval,
nconc(get_qpqual((Plan) retval),
fix_opids(get_actual_clauses
(get_loc
clause
info(best_path)))));
(get_loc
_restrict
info(best_path)))));
#endif
return
retval
;
...
...
@@ -730,7 +730,7 @@ fix_indxqual_references(Node *clause, Path *index_path)
if
(
new_subclauses
)
{
return
(
Node
*
)
make_clause
(
expr
->
opType
,
expr
->
oper
,
new_subclauses
);
make_clause
(
expr
->
opType
,
expr
->
oper
,
new_subclauses
);
}
else
return
clause
;
...
...
src/backend/optimizer/plan/initsplan.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.2
0 1998/09/01 04:29:50
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.2
1 1999/02/03 20:15:38
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -40,7 +40,7 @@
extern
int
Quiet
;
static
void
add_clause_to_rels
(
Query
*
root
,
List
*
clause
);
static
void
add_join_info_to_rels
(
Query
*
root
,
ClauseInfo
*
clause
info
,
static
void
add_join_info_to_rels
(
Query
*
root
,
RestrictInfo
*
restrict
info
,
List
*
join_relids
);
static
void
add_vars_to_targetlist
(
Query
*
root
,
List
*
vars
,
List
*
join_relids
);
...
...
@@ -140,7 +140,7 @@ add_missing_vars_to_tlist(Query *root, List *tlist)
/*
* init-base-rels-qual--
* Initializes
Clause
Info and JoinInfo fields of relation entries for all
* Initializes
Restrict
Info and JoinInfo fields of relation entries for all
* relations appearing within clauses. Creates new relation entries if
* necessary, adding them to *query-relation-list*.
*
...
...
@@ -158,9 +158,9 @@ init_base_rels_qual(Query *root, List *clauses)
/*
* add-clause-to-rels--
* Add clause information to either the '
Clause
Info' or 'JoinInfo' field
* Add clause information to either the '
Restrict
Info' or 'JoinInfo' field
* of a relation entry(depending on whether or not the clause is a join)
* by creating a new
Clause
Info node and setting appropriate fields
* by creating a new
Restrict
Info node and setting appropriate fields
* within the nodes.
*
* Returns nothing of interest.
...
...
@@ -170,19 +170,19 @@ add_clause_to_rels(Query *root, List *clause)
{
List
*
relids
;
List
*
vars
;
ClauseInfo
*
clauseinfo
=
makeNode
(
Clause
Info
);
RestrictInfo
*
restrictinfo
=
makeNode
(
Restrict
Info
);
/*
* Retrieve all relids and vars contained within the clause.
*/
clause_get_relids_vars
((
Node
*
)
clause
,
&
relids
,
&
vars
);
clause
info
->
clause
=
(
Expr
*
)
clause
;
clause
info
->
notclause
=
contains_not
((
Node
*
)
clause
);
clause
info
->
selectivity
=
0
;
clause
info
->
indexids
=
NIL
;
clause
info
->
mergejoinorder
=
(
MergeOrder
*
)
NULL
;
clause
info
->
hashjoinoperator
=
(
Oid
)
0
;
restrict
info
->
clause
=
(
Expr
*
)
clause
;
restrict
info
->
notclause
=
contains_not
((
Node
*
)
clause
);
restrict
info
->
selectivity
=
0
;
restrict
info
->
indexids
=
NIL
;
restrict
info
->
mergejoinorder
=
(
MergeOrder
*
)
NULL
;
restrict
info
->
hashjoinoperator
=
(
Oid
)
0
;
if
(
length
(
relids
)
==
1
)
{
...
...
@@ -204,14 +204,14 @@ add_clause_to_rels(Query *root, List *clause)
* XXX If we have a func clause set selectivity to 1/3, really
* need a true selectivity function.
*/
clause
info
->
selectivity
=
(
Cost
)
0
.
3333333
;
restrict
info
->
selectivity
=
(
Cost
)
0
.
3333333
;
}
else
{
clause
info
->
selectivity
=
restrict
info
->
selectivity
=
compute_clause_selec
(
root
,
(
Node
*
)
clause
,
NIL
);
}
rel
->
clauseinfo
=
lcons
(
clauseinfo
,
rel
->
clause
info
);
rel
->
restrictinfo
=
lcons
(
restrictinfo
,
rel
->
restrict
info
);
}
else
{
...
...
@@ -228,14 +228,14 @@ add_clause_to_rels(Query *root, List *clause)
* XXX If we have a func clause set selectivity to 1/3, really
* need a true selectivity function.
*/
clause
info
->
selectivity
=
(
Cost
)
0
.
3333333
;
restrict
info
->
selectivity
=
(
Cost
)
0
.
3333333
;
}
else
{
clause
info
->
selectivity
=
restrict
info
->
selectivity
=
compute_clause_selec
(
root
,
(
Node
*
)
clause
,
NIL
);
}
add_join_info_to_rels
(
root
,
clause
info
,
relids
);
add_join_info_to_rels
(
root
,
restrict
info
,
relids
);
/* we are going to be doing a join, so add var to targetlist */
add_vars_to_targetlist
(
root
,
vars
,
relids
);
}
...
...
@@ -243,18 +243,18 @@ add_clause_to_rels(Query *root, List *clause)
/*
* add-join-info-to-rels--
* For every relation participating in a join clause, add '
clause
info' to
* For every relation participating in a join clause, add '
restrict
info' to
* the appropriate joininfo node(creating a new one and adding it to the
* appropriate rel node if necessary).
*
* '
clause
info' describes the join clause
* '
restrict
info' describes the join clause
* 'join-relids' is the list of relations participating in the join clause
*
* Returns nothing.
*
*/
static
void
add_join_info_to_rels
(
Query
*
root
,
ClauseInfo
*
clause
info
,
List
*
join_relids
)
add_join_info_to_rels
(
Query
*
root
,
RestrictInfo
*
restrict
info
,
List
*
join_relids
)
{
List
*
join_relid
;
...
...
@@ -272,8 +272,8 @@ add_join_info_to_rels(Query *root, ClauseInfo * clauseinfo, List *join_relids)
joininfo
=
find_joininfo_node
(
get_base_rel
(
root
,
lfirsti
(
join_relid
)),
other_rels
);
joininfo
->
jinfo
clause
info
=
lcons
(
copyObject
((
void
*
)
clauseinfo
),
joininfo
->
jinfoclause
info
);
joininfo
->
jinfo
_restrict
info
=
lcons
(
copyObject
((
void
*
)
restrictinfo
),
joininfo
->
jinfo_restrict
info
);
}
}
...
...
@@ -322,7 +322,7 @@ add_vars_to_targetlist(Query *root, List *vars, List *join_relids)
* init-join-info--
* Set the MergeJoinable or HashJoinable field for every joininfo node
* (within a rel node) and the MergeJoinOrder or HashJoinOp field for
* each
clause
info node(within a joininfo node) for all relations in a
* each
restrict
info node(within a joininfo node) for all relations in a
* query.
*
* Returns nothing.
...
...
@@ -335,7 +335,7 @@ init_join_info(List *rel_list)
*
z
;
RelOptInfo
*
rel
;
JoinInfo
*
joininfo
;
ClauseInfo
*
clause
info
;
RestrictInfo
*
restrict
info
;
Expr
*
clause
;
foreach
(
x
,
rel_list
)
...
...
@@ -344,10 +344,10 @@ init_join_info(List *rel_list)
foreach
(
y
,
rel
->
joininfo
)
{
joininfo
=
(
JoinInfo
*
)
lfirst
(
y
);
foreach
(
z
,
joininfo
->
jinfo
clause
info
)
foreach
(
z
,
joininfo
->
jinfo
_restrict
info
)
{
clauseinfo
=
(
Clause
Info
*
)
lfirst
(
z
);
clause
=
clause
info
->
clause
;
restrictinfo
=
(
Restrict
Info
*
)
lfirst
(
z
);
clause
=
restrict
info
->
clause
;
if
(
is_joinable
((
Node
*
)
clause
))
{
MergeOrder
*
sortop
=
(
MergeOrder
*
)
NULL
;
...
...
@@ -360,12 +360,12 @@ init_join_info(List *rel_list)
if
(
sortop
)
{
clause
info
->
mergejoinorder
=
sortop
;
restrict
info
->
mergejoinorder
=
sortop
;
joininfo
->
mergejoinable
=
true
;
}
if
(
hashop
)
{
clause
info
->
hashjoinoperator
=
hashop
;
restrict
info
->
hashjoinoperator
=
hashop
;
joininfo
->
hashjoinable
=
true
;
}
}
...
...
src/backend/optimizer/plan/planner.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.4
0 1999/02/03 19:31:24 wieck
Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.4
1 1999/02/03 20:15:39 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -39,7 +39,7 @@
/* DATA STRUCTURE CREATION/MANIPULATION ROUTINES */
#include "nodes/relation.h"
#include "optimizer/
clause
info.h"
#include "optimizer/
restrict
info.h"
#include "optimizer/joininfo.h"
#include "optimizer/keys.h"
#include "optimizer/ordering.h"
...
...
src/backend/optimizer/plan/setrefs.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.3
5 1999/02/02 17:46:15
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.3
6 1999/02/03 20:15:39
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -26,7 +26,7 @@
#include "optimizer/internal.h"
#include "optimizer/clauses.h"
#include "optimizer/
clause
info.h"
#include "optimizer/
restrict
info.h"
#include "optimizer/keys.h"
#include "optimizer/planmain.h"
#include "optimizer/tlist.h"
...
...
src/backend/optimizer/util/clauseinfo.c
View file @
8d9237d4
/*-------------------------------------------------------------------------
*
*
clause
info.c--
*
Clause
Info node manipulation routines.
*
restrict
info.c--
*
Restrict
Info node manipulation routines.
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.
9 1998/09/01 04:30:00
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/clauseinfo.c,v 1.
10 1999/02/03 20:15:39
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -18,21 +18,21 @@
#include "optimizer/internal.h"
#include "optimizer/clauses.h"
#include "optimizer/
clause
info.h"
#include "optimizer/
restrict
info.h"
/*
* valid-or-clause--
*
* Returns t iff the
clause
info node contains a 'normal' 'or' clause.
* Returns t iff the
restrict
info node contains a 'normal' 'or' clause.
*
*/
bool
valid_or_clause
(
ClauseInfo
*
clause
info
)
valid_or_clause
(
RestrictInfo
*
restrict
info
)
{
if
(
clause
info
!=
NULL
&&
!
single_node
((
Node
*
)
clause
info
->
clause
)
&&
!
clause
info
->
notclause
&&
or_clause
((
Node
*
)
clause
info
->
clause
))
if
(
restrict
info
!=
NULL
&&
!
single_node
((
Node
*
)
restrict
info
->
clause
)
&&
!
restrict
info
->
notclause
&&
or_clause
((
Node
*
)
restrict
info
->
clause
))
return
true
;
else
return
false
;
...
...
@@ -41,19 +41,19 @@ valid_or_clause(ClauseInfo * clauseinfo)
/*
* get-actual-clauses--
*
* Returns a list containing the clauses from '
clause
info-list'.
* Returns a list containing the clauses from '
restrict
info-list'.
*
*/
List
*
get_actual_clauses
(
List
*
clause
info_list
)
get_actual_clauses
(
List
*
restrict
info_list
)
{
List
*
temp
=
NIL
;
List
*
result
=
NIL
;
ClauseInfo
*
clause
=
(
Clause
Info
*
)
NULL
;
RestrictInfo
*
clause
=
(
Restrict
Info
*
)
NULL
;
foreach
(
temp
,
clause
info_list
)
foreach
(
temp
,
restrict
info_list
)
{
clause
=
(
Clause
Info
*
)
lfirst
(
temp
);
clause
=
(
Restrict
Info
*
)
lfirst
(
temp
);
result
=
lappend
(
result
,
clause
->
clause
);
}
return
result
;
...
...
@@ -69,7 +69,7 @@ get_actual_clauses(List *clauseinfo_list)
/*
* get_relattvals--
* For each member of a list of
clause
info nodes to be used with an
* For each member of a list of
restrict
info nodes to be used with an
* index, create a vectori-long specifying:
* the attnos,
* the values of the clause constants, and
...
...
@@ -79,13 +79,13 @@ get_actual_clauses(List *clauseinfo_list)
* flag indicating whether the constant is on the left or right should
* always be *SELEC-CONSTANT-RIGHT*.
*
* '
clauseinfo-list' is a list of clause
info nodes
* '
restrictinfo-list' is a list of restrict
info nodes
*
* Returns a list of vectori-longs.
*
*/
void
get_relattvals
(
List
*
clause
info_list
,
get_relattvals
(
List
*
restrict
info_list
,
List
**
attnos
,
List
**
values
,
List
**
flags
)
...
...
@@ -93,17 +93,17 @@ get_relattvals(List *clauseinfo_list,
List
*
result1
=
NIL
;
List
*
result2
=
NIL
;
List
*
result3
=
NIL
;
ClauseInfo
*
temp
=
(
Clause
Info
*
)
NULL
;
RestrictInfo
*
temp
=
(
Restrict
Info
*
)
NULL
;
List
*
i
=
NIL
;
foreach
(
i
,
clause
info_list
)
foreach
(
i
,
restrict
info_list
)
{
int
dummy
;
AttrNumber
attno
;
Datum
constval
;
int
flag
;
temp
=
(
Clause
Info
*
)
lfirst
(
i
);
temp
=
(
Restrict
Info
*
)
lfirst
(
i
);
get_relattval
((
Node
*
)
temp
->
clause
,
&
dummy
,
&
attno
,
&
constval
,
&
flag
);
result1
=
lappendi
(
result1
,
(
int
)
attno
);
result2
=
lappendi
(
result2
,
constval
);
...
...
@@ -118,7 +118,7 @@ get_relattvals(List *clauseinfo_list,
/*
* get_joinvars --
* Given a list of join
clause
info nodes to be used with the index
* Given a list of join
restrict
info nodes to be used with the index
* of an inner join relation, return three lists consisting of:
* the attributes corresponding to the inner join relation
* the value of the inner var clause (always "")
...
...
@@ -126,13 +126,13 @@ get_relattvals(List *clauseinfo_list,
* the operator.
*
* 'relid' is the inner join relation
* '
clause
info-list' is a list of qualification clauses to be used with
* '
restrict
info-list' is a list of qualification clauses to be used with
* 'rel'
*
*/
void
get_joinvars
(
Oid
relid
,
List
*
clause
info_list
,
List
*
restrict
info_list
,
List
**
attnos
,
List
**
values
,
List
**
flags
)
...
...
@@ -142,10 +142,10 @@ get_joinvars(Oid relid,
List
*
result3
=
NIL
;
List
*
temp
;
foreach
(
temp
,
clause
info_list
)
foreach
(
temp
,
restrict
info_list
)
{
ClauseInfo
*
clause
info
=
lfirst
(
temp
);
Expr
*
clause
=
clause
info
->
clause
;
RestrictInfo
*
restrict
info
=
lfirst
(
temp
);
Expr
*
clause
=
restrict
info
->
clause
;
if
(
IsA
(
get_leftop
(
clause
),
Var
)
&&
(
relid
==
(
get_leftop
(
clause
))
->
varno
))
...
...
@@ -170,19 +170,19 @@ get_joinvars(Oid relid,
/*
* get_opnos--
* Create and return a list containing the clause operators of each member
* of a list of
clause
info nodes to be used with an index.
* of a list of
restrict
info nodes to be used with an index.
*
*/
List
*
get_opnos
(
List
*
clause
info_list
)
get_opnos
(
List
*
restrict
info_list
)
{
ClauseInfo
*
temp
=
(
Clause
Info
*
)
NULL
;
RestrictInfo
*
temp
=
(
Restrict
Info
*
)
NULL
;
List
*
result
=
NIL
;
List
*
i
=
NIL
;
foreach
(
i
,
clause
info_list
)
foreach
(
i
,
restrict
info_list
)
{
temp
=
(
Clause
Info
*
)
lfirst
(
i
);
temp
=
(
Restrict
Info
*
)
lfirst
(
i
);
result
=
lappendi
(
result
,
(((
Oper
*
)
temp
->
clause
->
oper
)
->
opno
));
...
...
src/backend/optimizer/util/indexnode.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.1
0 1998/09/01 04:30:04
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.1
1 1999/02/03 20:15:42
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -81,7 +81,7 @@ find_secondary_index(Query *root, Oid relid)
indexnode
->
unorderedpath
=
NULL
;
indexnode
->
cheapestpath
=
NULL
;
indexnode
->
pruneable
=
true
;
indexnode
->
clause
info
=
NIL
;
indexnode
->
restrict
info
=
NIL
;
indexnode
->
joininfo
=
NIL
;
indexnode
->
innerjoin
=
NIL
;
...
...
src/backend/optimizer/util/joininfo.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.1
2 1998/09/01 04:30:05
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.1
3 1999/02/03 20:15:42
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -71,7 +71,7 @@ find_joininfo_node(RelOptInfo * this_rel, List *join_relids)
{
joininfo
=
makeNode
(
JoinInfo
);
joininfo
->
otherrels
=
join_relids
;
joininfo
->
jinfo
clause
info
=
NIL
;
joininfo
->
jinfo
_restrict
info
=
NIL
;
joininfo
->
mergejoinable
=
false
;
joininfo
->
hashjoinable
=
false
;
joininfo
->
inactive
=
false
;
...
...
src/backend/optimizer/util/pathnode.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.1
4 1999/02/02 23:53:25
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.1
5 1999/02/03 20:15:42
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -20,7 +20,7 @@
#include "optimizer/internal.h"
#include "optimizer/pathnode.h"
#include "optimizer/
clause
info.h"
#include "optimizer/
restrict
info.h"
#include "optimizer/plancat.h"
#include "optimizer/cost.h"
#include "optimizer/keys.h"
...
...
@@ -209,11 +209,11 @@ create_seqscan_path(RelOptInfo * rel)
pathnode
->
keys
=
NIL
;
/*
* copy
clause
info list into path for expensive function processing --
* copy
restrict
info list into path for expensive function processing --
* JMH, 7/7/92
*/
pathnode
->
loc
clause
info
=
(
List
*
)
copyObject
((
Node
*
)
rel
->
clause
info
);
pathnode
->
loc
_restrict
info
=
(
List
*
)
copyObject
((
Node
*
)
rel
->
restrict
info
);
if
(
rel
->
relids
!=
NULL
)
relid
=
lfirsti
(
rel
->
relids
);
...
...
@@ -263,11 +263,11 @@ create_index_path(Query *root,
pathnode
->
indexqual
=
NIL
;
/*
* copy
clause
info list into path for expensive function processing --
* copy
restrict
info list into path for expensive function processing --
* JMH, 7/7/92
*/
pathnode
->
path
.
loc
clause
info
=
set_difference
((
List
*
)
copyObject
((
Node
*
)
rel
->
clause
info
),
pathnode
->
path
.
loc
_restrict
info
=
set_difference
((
List
*
)
copyObject
((
Node
*
)
rel
->
restrict
info
),
(
List
*
)
restriction_clauses
);
/*
...
...
@@ -410,11 +410,11 @@ create_nestloop_path(RelOptInfo * joinrel,
pathnode
->
path
.
parent
=
joinrel
;
pathnode
->
outerjoinpath
=
outer_path
;
pathnode
->
innerjoinpath
=
inner_path
;
pathnode
->
path
clauseinfo
=
joinrel
->
clause
info
;
pathnode
->
path
info
=
joinrel
->
restrict
info
;
pathnode
->
path
.
keys
=
keys
;
pathnode
->
path
.
joinid
=
NIL
;
pathnode
->
path
.
outerjoincost
=
(
Cost
)
0
.
0
;
pathnode
->
path
.
loc
clause
info
=
NIL
;
pathnode
->
path
.
loc
_restrict
info
=
NIL
;
if
(
keys
)
{
...
...
@@ -492,12 +492,12 @@ create_mergejoin_path(RelOptInfo * joinrel,
pathnode
->
jpath
.
path
.
parent
=
joinrel
;
pathnode
->
jpath
.
outerjoinpath
=
outer_path
;
pathnode
->
jpath
.
innerjoinpath
=
inner_path
;
pathnode
->
jpath
.
path
clauseinfo
=
joinrel
->
clause
info
;
pathnode
->
jpath
.
path
info
=
joinrel
->
restrict
info
;
pathnode
->
jpath
.
path
.
keys
=
keys
;
pathnode
->
jpath
.
path
.
p_ordering
.
ordtype
=
MERGE_ORDER
;
pathnode
->
jpath
.
path
.
p_ordering
.
ord
.
merge
=
order
;
pathnode
->
path_mergeclauses
=
mergeclauses
;
pathnode
->
jpath
.
path
.
loc
clause
info
=
NIL
;
pathnode
->
jpath
.
path
.
loc
_restrict
info
=
NIL
;
pathnode
->
outersortkeys
=
outersortkeys
;
pathnode
->
innersortkeys
=
innersortkeys
;
pathnode
->
jpath
.
path
.
path_cost
=
...
...
@@ -558,8 +558,8 @@ create_hashjoin_path(RelOptInfo * joinrel,
pathnode
->
jpath
.
path
.
parent
=
joinrel
;
pathnode
->
jpath
.
outerjoinpath
=
outer_path
;
pathnode
->
jpath
.
innerjoinpath
=
inner_path
;
pathnode
->
jpath
.
path
clauseinfo
=
joinrel
->
clause
info
;
pathnode
->
jpath
.
path
.
loc
clause
info
=
NIL
;
pathnode
->
jpath
.
path
info
=
joinrel
->
restrict
info
;
pathnode
->
jpath
.
path
.
loc
_restrict
info
=
NIL
;
pathnode
->
jpath
.
path
.
keys
=
keys
;
pathnode
->
jpath
.
path
.
p_ordering
.
ordtype
=
SORTOP_ORDER
;
pathnode
->
jpath
.
path
.
p_ordering
.
ord
.
sortop
=
NULL
;
...
...
src/backend/optimizer/util/relnode.c
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.
9 1998/09/01 04:30:11
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.
10 1999/02/03 20:15:43
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -51,7 +51,7 @@ get_base_rel(Query *root, int relid)
rel
->
classlist
=
NULL
;
rel
->
ordering
=
NULL
;
rel
->
relam
=
InvalidOid
;
rel
->
clause
info
=
NIL
;
rel
->
restrict
info
=
NIL
;
rel
->
joininfo
=
NIL
;
rel
->
innerjoin
=
NIL
;
rel
->
superrels
=
NIL
;
...
...
src/include/nodes/nodes.h
View file @
8d9237d4
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: nodes.h,v 1.3
5 1999/01/24 00:28:33
momjian Exp $
* $Id: nodes.h,v 1.3
6 1999/02/03 20:15:46
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -79,7 +79,7 @@ typedef enum NodeTag
T_OrderKey
,
T_JoinKey
,
T_MergeOrder
,
T_
Clause
Info
,
T_
Restrict
Info
,
T_JoinMethod
,
T_HInfo
,
T_MInfo
,
...
...
src/include/nodes/relation.h
View file @
8d9237d4
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: relation.h,v 1.1
1 1998/09/01 04:36:51
momjian Exp $
* $Id: relation.h,v 1.1
2 1999/02/03 20:15:46
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -60,7 +60,7 @@ typedef List *Relid;
* * The presence of the remaining fields depends on the restrictions
* and joins which the relation participates in:
*
*
clauseinfo - List of Clause
Info nodes, containing info about each
*
restrictinfo - List of Restrict
Info nodes, containing info about each
* qualification clause in which this relation participates
* joininfo - List of JoinInfo nodes, containing info about each join
* clause in which this relation participates
...
...
@@ -102,7 +102,7 @@ typedef struct RelOptInfo
/* used by various scans and joins: */
Oid
*
ordering
;
/* OID of operators in sort order */
List
*
clause
info
;
/* restriction clauses */
List
*
restrict
info
;
/* restriction clauses */
List
*
joininfo
;
/* join clauses */
List
*
innerjoin
;
List
*
superrels
;
...
...
@@ -149,7 +149,7 @@ typedef struct Path
List
*
keys
;
Cost
outerjoincost
;
Relid
joinid
;
List
*
loc
clause
info
;
List
*
loc
_restrict
info
;
}
Path
;
typedef
struct
IndexPath
...
...
@@ -164,7 +164,7 @@ typedef struct IndexPath
typedef
struct
JoinPath
{
Path
path
;
List
*
path
clause
info
;
List
*
pathinfo
;
Path
*
outerjoinpath
;
Path
*
innerjoinpath
;
}
JoinPath
;
...
...
@@ -207,7 +207,7 @@ typedef struct JoinKey
* clause info
*******/
typedef
struct
Clause
Info
typedef
struct
Restrict
Info
{
NodeTag
type
;
Expr
*
clause
;
/* should be an OP clause */
...
...
@@ -221,7 +221,7 @@ typedef struct ClauseInfo
/* hashjoin only */
Oid
hashjoinoperator
;
Relid
cinfojoinid
;
}
Clause
Info
;
}
Restrict
Info
;
typedef
struct
JoinMethod
{
...
...
@@ -246,7 +246,7 @@ typedef struct JoinInfo
{
NodeTag
type
;
List
*
otherrels
;
List
*
jinfo
clause
info
;
List
*
jinfo
_restrict
info
;
bool
mergejoinable
;
bool
hashjoinable
;
bool
inactive
;
...
...
@@ -271,7 +271,7 @@ typedef struct Iter
** pathptr -- pointer to the current path node
** cinfo -- if NULL, this stream node referes to the path node.
** Otherwise this is a pointer to the current clause.
** clausetype -- whether cinfo is in loc
clauseinfo or pathclause
info in the
** clausetype -- whether cinfo is in loc
_restrictinfo or path
info in the
** path node
** upstream -- linked list pointer upwards
** downstream -- ditto, downwards
...
...
@@ -285,7 +285,7 @@ typedef struct Stream
{
NodeTag
type
;
Path
*
pathptr
;
Clause
Info
*
cinfo
;
Restrict
Info
*
cinfo
;
int
*
clausetype
;
struct
Stream
*
upstream
;
struct
Stream
*
downstream
;
...
...
src/include/optimizer/cost.h
View file @
8d9237d4
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: cost.h,v 1.1
1 1998/09/01 04:36:54
momjian Exp $
* $Id: cost.h,v 1.1
2 1999/02/03 20:15:52
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -52,10 +52,10 @@ extern int page_size(int tuples, int width);
* prototypes for fuctions in clausesel.h--
* routines to compute clause selectivities
*/
extern
void
set_clause_selectivities
(
List
*
clause
info_list
,
Cost
new_selectivity
);
extern
Cost
product_selec
(
List
*
clause
info_list
);
extern
void
set_clause_selectivities
(
List
*
restrict
info_list
,
Cost
new_selectivity
);
extern
Cost
product_selec
(
List
*
restrict
info_list
);
extern
void
set_rest_relselec
(
Query
*
root
,
List
*
rel_list
);
extern
void
set_rest_selec
(
Query
*
root
,
List
*
clause
info_list
);
extern
void
set_rest_selec
(
Query
*
root
,
List
*
restrict
info_list
);
extern
Cost
compute_clause_selec
(
Query
*
root
,
Node
*
clause
,
List
*
or_selectivities
);
...
...
src/include/optimizer/paths.h
View file @
8d9237d4
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: paths.h,v 1.1
0 1998/09/01 04:37:14
momjian Exp $
* $Id: paths.h,v 1.1
1 1999/02/03 20:15:53
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -28,7 +28,7 @@ extern List *find_paths(Query *root, List *rels);
* routines to generate index paths
*/
extern
List
*
find_index_paths
(
Query
*
root
,
RelOptInfo
*
rel
,
List
*
indices
,
List
*
clause
info_list
,
List
*
restrict
info_list
,
List
*
joininfo_list
);
/*
...
...
@@ -47,7 +47,7 @@ extern List *create_or_index_paths(Query *root, RelOptInfo * rel, List *clauses)
* hashutils.h
* routines to deal with hash keys and clauses
*/
extern
List
*
group_clauses_by_hashop
(
List
*
clause
info_list
,
extern
List
*
group_clauses_by_hashop
(
List
*
restrict
info_list
,
int
inner_relid
);
/*
...
...
@@ -68,7 +68,7 @@ extern List *new_join_pathkeys(List *outer_pathkeys,
* mergeutils.h
* routines to deal with merge keys and clauses
*/
extern
List
*
group_clauses_by_order
(
List
*
clause
info_list
,
extern
List
*
group_clauses_by_order
(
List
*
restrict
info_list
,
int
inner_relid
);
extern
MInfo
*
match_order_mergeinfo
(
PathOrder
*
ordering
,
List
*
mergeinfo_list
);
...
...
src/include/optimizer/
clause
info.h
→
src/include/optimizer/
restrict
info.h
View file @
8d9237d4
/*-------------------------------------------------------------------------
*
*
clause
info.h--
* prototypes for
clause
info.c.
*
restrict
info.h--
* prototypes for
restrict
info.c.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id:
clauseinfo.h,v 1.9 1998/09/01 04:36:52
momjian Exp $
* $Id:
restrictinfo.h,v 1.1 1999/02/03 20:15:53
momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef
CLAUSE
INFO_H
#define
CLAUSE
INFO_H
#ifndef
RESTRICT
INFO_H
#define
RESTRICT
INFO_H
#include "nodes/pg_list.h"
#include "nodes/relation.h"
extern
bool
valid_or_clause
(
ClauseInfo
*
clause
info
);
extern
List
*
get_actual_clauses
(
List
*
clause
info_list
);
extern
void
get_relattvals
(
List
*
clause
info_list
,
List
**
attnos
,
extern
bool
valid_or_clause
(
RestrictInfo
*
restrict
info
);
extern
List
*
get_actual_clauses
(
List
*
restrict
info_list
);
extern
void
get_relattvals
(
List
*
restrict
info_list
,
List
**
attnos
,
List
**
values
,
List
**
flags
);
extern
void
get_joinvars
(
Oid
relid
,
List
*
clause
info_list
,
extern
void
get_joinvars
(
Oid
relid
,
List
*
restrict
info_list
,
List
**
attnos
,
List
**
values
,
List
**
flags
);
extern
List
*
get_opnos
(
List
*
clause
info_list
);
extern
List
*
get_opnos
(
List
*
restrict
info_list
);
#endif
/*
CLAUSE
INFO_H */
#endif
/*
RESTRICT
INFO_H */
src/include/optimizer/xfunc.h
View file @
8d9237d4
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: xfunc.h,v 1.1
0 1998/09/01 04:37:24
momjian Exp $
* $Id: xfunc.h,v 1.1
1 1999/02/03 20:15:53
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -51,8 +51,8 @@ extern int XfuncMode; /* defined in tcop/postgres.c */
/* function prototypes from planner/path/xfunc.c */
extern
void
xfunc_trypullup
(
RelOptInfo
*
rel
);
extern
int
xfunc_shouldpull
(
Path
*
childpath
,
JoinPath
*
parentpath
,
int
whichchild
,
Clause
Info
*
maxcinfopt
);
extern
ClauseInfo
*
xfunc_pullup
(
Path
*
childpath
,
JoinPath
*
parentpath
,
Clause
Info
*
cinfo
,
int
whichchild
,
Restrict
Info
*
maxcinfopt
);
extern
RestrictInfo
*
xfunc_pullup
(
Path
*
childpath
,
JoinPath
*
parentpath
,
Restrict
Info
*
cinfo
,
int
whichchild
,
int
clausetype
);
extern
Cost
xfunc_rank
(
Expr
*
clause
);
extern
Cost
xfunc_expense
(
Query
*
queryInfo
,
Expr
*
clause
);
...
...
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