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
584f9438
Commit
584f9438
authored
Jul 18, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename Rel to RelOptInfo.
parent
3a132e9d
Changes
38
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
295 additions
and
295 deletions
+295
-295
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+5
-5
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+5
-5
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+6
-6
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/geqo/geqo_eval.c
+32
-32
src/backend/optimizer/geqo/geqo_main.c
src/backend/optimizer/geqo/geqo_main.c
+4
-4
src/backend/optimizer/geqo/geqo_misc.c
src/backend/optimizer/geqo/geqo_misc.c
+2
-2
src/backend/optimizer/geqo/geqo_paths.c
src/backend/optimizer/geqo/geqo_paths.c
+9
-9
src/backend/optimizer/geqo/minspantree.c
src/backend/optimizer/geqo/minspantree.c
+15
-15
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/allpaths.c
+8
-8
src/backend/optimizer/path/clausesel.c
src/backend/optimizer/path/clausesel.c
+3
-3
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/costsize.c
+3
-3
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/indxpath.c
+34
-34
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinpath.c
+22
-22
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/joinrels.c
+26
-26
src/backend/optimizer/path/orindxpath.c
src/backend/optimizer/path/orindxpath.c
+7
-7
src/backend/optimizer/path/prune.c
src/backend/optimizer/path/prune.c
+11
-11
src/backend/optimizer/path/xfunc.c
src/backend/optimizer/path/xfunc.c
+18
-18
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/createplan.c
+2
-2
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/initsplan.c
+7
-7
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planmain.c
+4
-4
src/backend/optimizer/util/indexnode.c
src/backend/optimizer/util/indexnode.c
+3
-3
src/backend/optimizer/util/joininfo.c
src/backend/optimizer/util/joininfo.c
+2
-2
src/backend/optimizer/util/keys.c
src/backend/optimizer/util/keys.c
+2
-2
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/pathnode.c
+11
-11
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/relnode.c
+8
-8
src/backend/optimizer/util/tlist.c
src/backend/optimizer/util/tlist.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
+6
-6
src/include/optimizer/cost.h
src/include/optimizer/cost.h
+3
-3
src/include/optimizer/geqo.h
src/include/optimizer/geqo.h
+3
-3
src/include/optimizer/geqo_misc.h
src/include/optimizer/geqo_misc.h
+2
-2
src/include/optimizer/geqo_paths.h
src/include/optimizer/geqo_paths.h
+2
-2
src/include/optimizer/joininfo.h
src/include/optimizer/joininfo.h
+2
-2
src/include/optimizer/keys.h
src/include/optimizer/keys.h
+2
-2
src/include/optimizer/pathnode.h
src/include/optimizer/pathnode.h
+12
-12
src/include/optimizer/paths.h
src/include/optimizer/paths.h
+4
-4
src/include/optimizer/tlist.h
src/include/optimizer/tlist.h
+2
-2
src/include/optimizer/xfunc.h
src/include/optimizer/xfunc.h
+4
-4
No files found.
src/backend/nodes/copyfuncs.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.4
3 1998/07/15 14:54:31
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.4
4 1998/07/18 04:22:25
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -998,10 +998,10 @@ _copyArrayRef(ArrayRef *from)
** planner/path/xfunc.c accordingly!!!
** -- JMH, 8/2/93
*/
static
Rel
*
_copyRel
(
Rel
*
from
)
static
Rel
OptInfo
*
_copyRel
(
Rel
OptInfo
*
from
)
{
Rel
*
newnode
=
makeNode
(
Rel
);
Rel
OptInfo
*
newnode
=
makeNode
(
RelOptInfo
);
int
i
,
len
;
...
...
@@ -1734,7 +1734,7 @@ copyObject(void *from)
/*
* RELATION NODES
*/
case
T_Rel
:
case
T_Rel
OptInfo
:
retval
=
_copyRel
(
from
);
break
;
case
T_Path
:
...
...
src/backend/nodes/outfuncs.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.4
0 1998/07/15 14:54:32
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.4
1 1998/07/18 04:22:26
momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
...
...
@@ -990,11 +990,11 @@ _outEState(StringInfo str, EState *node)
* Stuff from relation.h
*/
static
void
_outRel
(
StringInfo
str
,
Rel
*
node
)
_outRel
(
StringInfo
str
,
Rel
OptInfo
*
node
)
{
char
buf
[
500
];
appendStringInfo
(
str
,
" REL "
);
appendStringInfo
(
str
,
" REL
OPTINFO
"
);
appendStringInfo
(
str
,
" :relids "
);
_outIntList
(
str
,
node
->
relids
);
...
...
@@ -1058,7 +1058,7 @@ _outRel(StringInfo str, Rel *node)
static
void
_outTargetEntry
(
StringInfo
str
,
TargetEntry
*
node
)
{
appendStringInfo
(
str
,
" T
LE
"
);
appendStringInfo
(
str
,
" T
ARGETENTRY
"
);
appendStringInfo
(
str
,
" :resdom "
);
_outNode
(
str
,
node
->
resdom
);
...
...
@@ -1787,7 +1787,7 @@ _outNode(StringInfo str, void *obj)
case
T_EState
:
_outEState
(
str
,
obj
);
break
;
case
T_Rel
:
case
T_Rel
OptInfo
:
_outRel
(
str
,
obj
);
break
;
case
T_TargetEntry
:
...
...
src/backend/nodes/readfuncs.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.3
2 1998/07/15 14:54:34
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.3
3 1998/07/18 04:22:26
momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
...
...
@@ -1221,14 +1221,14 @@ _readEState()
* _readRel
* ----------------
*/
static
Rel
*
static
Rel
OptInfo
*
_readRel
()
{
Rel
*
local_node
;
Rel
OptInfo
*
local_node
;
char
*
token
;
int
length
;
local_node
=
makeNode
(
Rel
);
local_node
=
makeNode
(
Rel
OptInfo
);
token
=
lsptok
(
NULL
,
&
length
);
/* get :relids */
local_node
->
relids
=
...
...
@@ -1990,9 +1990,9 @@ parsePlanString(void)
return_value
=
_readParam
();
else
if
(
!
strncmp
(
token
,
"ESTATE"
,
length
))
return_value
=
_readEState
();
else
if
(
!
strncmp
(
token
,
"REL"
,
length
))
else
if
(
!
strncmp
(
token
,
"REL
OPTINFO
"
,
length
))
return_value
=
_readRel
();
else
if
(
!
strncmp
(
token
,
"T
LE
"
,
length
))
else
if
(
!
strncmp
(
token
,
"T
ARGETENTRY
"
,
length
))
return_value
=
_readTargetEntry
();
else
if
(
!
strncmp
(
token
,
"RTE"
,
length
))
return_value
=
_readRangeTblEntry
();
...
...
src/backend/optimizer/geqo/geqo_eval.c
View file @
584f9438
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_eval.c,v 1.
19 1998/06/15 19:28:35
momjian Exp $
* $Id: geqo_eval.c,v 1.
20 1998/07/18 04:22:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -50,13 +50,13 @@
#include "optimizer/geqo_paths.h"
static
List
*
gimme_clause_joins
(
Query
*
root
,
Rel
*
outer_rel
,
Rel
*
inner_rel
);
static
Rel
*
gimme_clauseless_join
(
Rel
*
outer_rel
,
Rel
*
inner_rel
);
static
Rel
*
init_join_rel
(
Rel
*
outer_rel
,
Rel
*
inner_rel
,
JInfo
*
joininfo
);
static
List
*
gimme_clause_joins
(
Query
*
root
,
Rel
OptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
);
static
Rel
OptInfo
*
gimme_clauseless_join
(
RelOptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
);
static
Rel
OptInfo
*
init_join_rel
(
RelOptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
,
JInfo
*
joininfo
);
static
List
*
new_join_tlist
(
List
*
tlist
,
List
*
other_relids
,
int
first_resdomno
);
static
List
*
new_joininfo_list
(
List
*
joininfo_list
,
List
*
join_relids
);
static
void
geqo_joinrel_size
(
Rel
*
joinrel
,
Rel
*
outer_rel
,
Rel
*
inner_rel
);
static
Rel
*
geqo_nth
(
int
stop
,
List
*
rels
);
static
void
geqo_joinrel_size
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
);
static
Rel
OptInfo
*
geqo_nth
(
int
stop
,
List
*
rels
);
/*
* geqo_eval--
...
...
@@ -66,7 +66,7 @@ static Rel *geqo_nth(int stop, List *rels);
Cost
geqo_eval
(
Query
*
root
,
Gene
*
tour
,
int
num_gene
)
{
Rel
*
joinrel
;
Rel
OptInfo
*
joinrel
;
Cost
fitness
;
List
*
temp
;
...
...
@@ -98,14 +98,14 @@ geqo_eval(Query *root, Gene *tour, int num_gene)
*
* Returns a new join relation incorporating all joins in a left-sided tree.
*/
Rel
*
gimme_tree
(
Query
*
root
,
Gene
*
tour
,
int
rel_count
,
int
num_gene
,
Rel
*
outer_rel
)
Rel
OptInfo
*
gimme_tree
(
Query
*
root
,
Gene
*
tour
,
int
rel_count
,
int
num_gene
,
Rel
OptInfo
*
outer_rel
)
{
Rel
*
inner_rel
;
/* current relation */
Rel
OptInfo
*
inner_rel
;
/* current relation */
int
base_rel_index
;
List
*
new_rels
=
NIL
;
Rel
*
new_rel
=
NULL
;
Rel
OptInfo
*
new_rel
=
NULL
;
if
(
rel_count
<
num_gene
)
{
/* tree not yet finished */
...
...
@@ -113,7 +113,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
/* tour[0] = 3; tour[1] = 1; tour[2] = 2 */
base_rel_index
=
(
int
)
tour
[
rel_count
];
inner_rel
=
(
Rel
*
)
geqo_nth
(
base_rel_index
,
root
->
base_relation_list_
);
inner_rel
=
(
Rel
OptInfo
*
)
geqo_nth
(
base_rel_index
,
root
->
base_relation_list_
);
if
(
rel_count
==
0
)
{
/* processing first join with
...
...
@@ -158,7 +158,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
}
/* get essential new relation */
new_rel
=
(
Rel
*
)
lfirst
(
new_rels
);
new_rel
=
(
Rel
OptInfo
*
)
lfirst
(
new_rels
);
rel_count
++
;
/* process new_rel->cheapestpath, new_rel->unorderedpath */
...
...
@@ -189,7 +189,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, Rel *outer_rel)
*/
static
List
*
gimme_clause_joins
(
Query
*
root
,
Rel
*
outer_rel
,
Rel
*
inner_rel
)
gimme_clause_joins
(
Query
*
root
,
Rel
OptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
)
{
List
*
join_list
=
NIL
;
List
*
i
=
NIL
;
...
...
@@ -198,7 +198,7 @@ gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel)
foreach
(
i
,
joininfo_list
)
{
JInfo
*
joininfo
=
(
JInfo
*
)
lfirst
(
i
);
Rel
*
rel
=
NULL
;
Rel
OptInfo
*
rel
=
NULL
;
if
(
!
joininfo
->
inactive
)
{
...
...
@@ -239,8 +239,8 @@ gimme_clause_joins(Query *root, Rel *outer_rel, Rel *inner_rel)
* Returns a new join relation.
*/
static
Rel
*
gimme_clauseless_join
(
Rel
*
outer_rel
,
Rel
*
inner_rel
)
static
Rel
OptInfo
*
gimme_clauseless_join
(
Rel
OptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
)
{
return
(
init_join_rel
(
outer_rel
,
inner_rel
,
(
JInfo
*
)
NULL
));
}
...
...
@@ -256,10 +256,10 @@ gimme_clauseless_join(Rel *outer_rel, Rel *inner_rel)
*
* Returns the new join relation node.
*/
static
Rel
*
init_join_rel
(
Rel
*
outer_rel
,
Rel
*
inner_rel
,
JInfo
*
joininfo
)
static
Rel
OptInfo
*
init_join_rel
(
Rel
OptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
,
JInfo
*
joininfo
)
{
Rel
*
joinrel
=
makeNode
(
Rel
);
Rel
OptInfo
*
joinrel
=
makeNode
(
RelOptInfo
);
List
*
joinrel_joininfo_list
=
NIL
;
List
*
new_outer_tlist
;
List
*
new_inner_tlist
;
...
...
@@ -457,7 +457,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
List
*
xrel
=
NIL
;
List
*
xjoininfo
=
NIL
;
Rel
*
rel
;
Rel
OptInfo
*
rel
;
List
*
relids
;
List
*
super_rels
;
...
...
@@ -466,7 +466,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach
(
xjoinrel
,
joinrels
)
{
Rel
*
joinrel
=
(
Rel
*
)
lfirst
(
xjoinrel
);
Rel
OptInfo
*
joinrel
=
(
RelOptInfo
*
)
lfirst
(
xjoinrel
);
foreach
(
xrelid
,
joinrel
->
relids
)
{
...
...
@@ -477,7 +477,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
*/
/*
* ! BUG BUG ! Relid relid = (Relid)lfirst(xrelid); Rel *rel =
* ! BUG BUG ! Relid relid = (Relid)lfirst(xrelid); Rel
OptInfo
*rel =
* get_join_rel(root, relid);
*/
...
...
@@ -502,7 +502,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
}
foreach
(
xjoinrel
,
joinrels
)
{
Rel
*
joinrel
=
(
Rel
*
)
lfirst
(
xjoinrel
);
Rel
OptInfo
*
joinrel
=
(
RelOptInfo
*
)
lfirst
(
xjoinrel
);
foreach
(
xjoininfo
,
joinrel
->
joininfo
)
{
...
...
@@ -516,7 +516,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
{
/*
* ! BUG BUG ! Relid relid = (Relid)lfirst(xrelid); Rel
* ! BUG BUG ! Relid relid = (Relid)lfirst(xrelid); Rel
OptInfo
* *rel = get_join_rel(root, relid);
*/
...
...
@@ -549,7 +549,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach
(
xsuper_rel
,
super_rels
)
{
Rel
*
super_rel
=
(
Rel
*
)
lfirst
(
xsuper_rel
);
Rel
OptInfo
*
super_rel
=
(
RelOptInfo
*
)
lfirst
(
xsuper_rel
);
if
(
nonoverlap_rels
(
super_rel
,
joinrel
))
{
...
...
@@ -584,7 +584,7 @@ geqo_add_new_joininfos(Query *root, List *joinrels, List *outerrels)
}
foreach
(
xrel
,
outerrels
)
{
rel
=
(
Rel
*
)
lfirst
(
xrel
);
rel
=
(
Rel
OptInfo
*
)
lfirst
(
xrel
);
rel
->
superrels
=
NIL
;
}
}
...
...
@@ -611,7 +611,7 @@ geqo_final_join_rels(List *join_rel_list)
*/
foreach
(
xrel
,
join_rel_list
)
{
Rel
*
rel
=
(
Rel
*
)
lfirst
(
xrel
);
Rel
OptInfo
*
rel
=
(
RelOptInfo
*
)
lfirst
(
xrel
);
List
*
xjoininfo
=
NIL
;
bool
final
=
true
;
...
...
@@ -645,7 +645,7 @@ geqo_final_join_rels(List *join_rel_list)
* Modifies the superrels field of rel
*/
static
void
add_superrels
(
Rel
*
rel
,
Rel
*
super_rel
)
add_superrels
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
super_rel
)
{
rel
->
superrels
=
lappend
(
rel
->
superrels
,
super_rel
);
}
...
...
@@ -660,7 +660,7 @@ add_superrels(Rel *rel, Rel *super_rel)
* Returns non-nil if rel1 and rel2 do not overlap.
*/
static
bool
nonoverlap_rels
(
Rel
*
rel1
,
Rel
*
rel2
)
nonoverlap_rels
(
Rel
OptInfo
*
rel1
,
RelOptInfo
*
rel2
)
{
return
(
nonoverlap_sets
(
rel1
->
relids
,
rel2
->
relids
));
}
...
...
@@ -688,7 +688,7 @@ nonoverlap_sets(List *s1, List *s2)
* long join queries; so get logarithm of size when MAXINT overflow;
*/
static
void
geqo_joinrel_size
(
Rel
*
joinrel
,
Rel
*
outer_rel
,
Rel
*
inner_rel
)
geqo_joinrel_size
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
)
{
Cost
temp
;
int
ntuples
;
...
...
@@ -715,7 +715,7 @@ geqo_log(double x, double b)
return
(
log
(
x
)
/
log
(
b
));
}
static
Rel
*
static
Rel
OptInfo
*
geqo_nth
(
int
stop
,
List
*
rels
)
{
List
*
r
;
...
...
src/backend/optimizer/geqo/geqo_main.c
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_main.c,v 1.
7 1998/02/26 04:32:22
momjian Exp $
* $Id: geqo_main.c,v 1.
8 1998/07/18 04:22:27
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -63,7 +63,7 @@
* similar to a constrained Traveling Salesman Problem (TSP)
*/
Rel
*
Rel
OptInfo
*
geqo
(
Query
*
root
)
{
int
generation
;
...
...
@@ -98,7 +98,7 @@ geqo(Query *root)
status_interval
;
Gene
*
best_tour
;
Rel
*
best_rel
;
Rel
OptInfo
*
best_rel
;
/* Plan *best_plan; */
...
...
@@ -254,7 +254,7 @@ geqo(Query *root)
best_tour
=
(
Gene
*
)
pool
->
data
[
0
].
string
;
/* root->join_relation_list_ will be modified during this ! */
best_rel
=
(
Rel
*
)
gimme_tree
(
root
,
best_tour
,
0
,
pool
->
string_length
,
NULL
);
best_rel
=
(
Rel
OptInfo
*
)
gimme_tree
(
root
,
best_tour
,
0
,
pool
->
string_length
,
NULL
);
/* DBG: show the query plan
print_plan(best_plan, root);
...
...
src/backend/optimizer/geqo/geqo_misc.c
View file @
584f9438
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_misc.c,v 1.
8 1998/06/15 19:28:35
momjian Exp $
* $Id: geqo_misc.c,v 1.
9 1998/07/18 04:22:28
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -262,7 +262,7 @@ geqo_print_path(Query *root, Path *path, int indent)
}
void
geqo_print_rel
(
Query
*
root
,
Rel
*
rel
)
geqo_print_rel
(
Query
*
root
,
Rel
OptInfo
*
rel
)
{
List
*
l
;
...
...
src/backend/optimizer/geqo/geqo_paths.c
View file @
584f9438
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_paths.c,v 1.
9 1998/06/15 19:28:37
momjian Exp $
* $Id: geqo_paths.c,v 1.
10 1998/07/18 04:22:28
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -28,8 +28,8 @@
#include "optimizer/geqo_paths.h"
static
List
*
geqo_prune_rel
(
Rel
*
rel
,
List
*
other_rels
);
static
Path
*
set_paths
(
Rel
*
rel
,
Path
*
unorderedpath
);
static
List
*
geqo_prune_rel
(
Rel
OptInfo
*
rel
,
List
*
other_rels
);
static
Path
*
set_paths
(
Rel
OptInfo
*
rel
,
Path
*
unorderedpath
);
/*
* geqo-prune-rels--
...
...
@@ -47,7 +47,7 @@ geqo_prune_rels(List *rel_list)
if
(
rel_list
!=
NIL
)
{
temp_list
=
lcons
(
lfirst
(
rel_list
),
geqo_prune_rels
(
geqo_prune_rel
((
Rel
*
)
lfirst
(
rel_list
),
geqo_prune_rels
(
geqo_prune_rel
((
Rel
OptInfo
*
)
lfirst
(
rel_list
),
lnext
(
rel_list
))));
}
return
(
temp_list
);
...
...
@@ -65,16 +65,16 @@ geqo_prune_rels(List *rel_list)
*
*/
static
List
*
geqo_prune_rel
(
Rel
*
rel
,
List
*
other_rels
)
geqo_prune_rel
(
Rel
OptInfo
*
rel
,
List
*
other_rels
)
{
List
*
i
=
NIL
;
List
*
t_list
=
NIL
;
List
*
temp_node
=
NIL
;
Rel
*
other_rel
=
(
Rel
*
)
NULL
;
Rel
OptInfo
*
other_rel
=
(
RelOptInfo
*
)
NULL
;
foreach
(
i
,
other_rels
)
{
other_rel
=
(
Rel
*
)
lfirst
(
i
);
other_rel
=
(
Rel
OptInfo
*
)
lfirst
(
i
);
if
(
same
(
rel
->
relids
,
other_rel
->
relids
))
{
rel
->
pathlist
=
add_pathlist
(
rel
,
...
...
@@ -102,7 +102,7 @@ geqo_prune_rel(Rel *rel, List *other_rels)
*
*/
void
geqo_rel_paths
(
Rel
*
rel
)
geqo_rel_paths
(
Rel
OptInfo
*
rel
)
{
List
*
y
=
NIL
;
Path
*
path
=
(
Path
*
)
NULL
;
...
...
@@ -134,7 +134,7 @@ geqo_rel_paths(Rel *rel)
*
*/
static
Path
*
set_paths
(
Rel
*
rel
,
Path
*
unorderedpath
)
set_paths
(
Rel
OptInfo
*
rel
,
Path
*
unorderedpath
)
{
Path
*
cheapest
=
set_cheapest
(
rel
,
rel
->
pathlist
);
...
...
src/backend/optimizer/geqo/minspantree.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.
5 1998/06/15 19:28:38
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/geqo/Attic/minspantree.c,v 1.
6 1998/07/18 04:22:29
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -41,7 +41,7 @@
*/
void
minspantree
(
Query
*
root
,
List
*
join_rels
,
Rel
*
garel
)
minspantree
(
Query
*
root
,
List
*
join_rels
,
Rel
OptInfo
*
garel
)
{
int
number_of_rels
=
length
(
root
->
base_relation_list_
);
int
number_of_joins
=
length
(
join_rels
);
...
...
@@ -70,28 +70,28 @@ minspantree(Query *root, List *join_rels, Rel *garel)
id1
,
id2
;
List
*
r
=
NIL
;
Rel
*
joinrel
=
NULL
;
Rel
**
tmprel_array
;
Rel
OptInfo
*
joinrel
=
NULL
;
Rel
OptInfo
**
tmprel_array
;
/* allocate memory for matrix tmprel_array[x][y] */
tmprel_array
=
(
Rel
**
)
palloc
((
number_of_rels
+
1
)
*
sizeof
(
Rel
*
));
tmprel_array
=
(
Rel
OptInfo
**
)
palloc
((
number_of_rels
+
1
)
*
sizeof
(
RelOptInfo
*
));
for
(
i
=
0
;
i
<=
number_of_rels
;
i
++
)
(
tmprel_array
[
i
]
=
(
Rel
*
)
palloc
((
number_of_rels
+
1
)
*
sizeof
(
Rel
)));
(
tmprel_array
[
i
]
=
(
Rel
OptInfo
*
)
palloc
((
number_of_rels
+
1
)
*
sizeof
(
RelOptInfo
)));
/* read relations of join-relations into tmprel_array */
foreach
(
r
,
join_rels
)
{
joinrel
=
(
Rel
*
)
lfirst
(
r
);
joinrel
=
(
Rel
OptInfo
*
)
lfirst
(
r
);
id1
=
(
int
)
lfirst
(
joinrel
->
relids
);
id2
=
(
int
)
lsecond
(
joinrel
->
relids
);
if
(
id1
>
id2
)
tmprel_array
[
id2
][
id1
]
=
*
(
Rel
*
)
joinrel
;
tmprel_array
[
id2
][
id1
]
=
*
(
Rel
OptInfo
*
)
joinrel
;
else
{
tmprel_array
[
id1
][
id2
]
=
*
(
Rel
*
)
joinrel
;
/* ever reached? */
tmprel_array
[
id1
][
id2
]
=
*
(
Rel
OptInfo
*
)
joinrel
;
/* ever reached? */
}
}
...
...
@@ -103,7 +103,7 @@ minspantree(Query *root, List *join_rels, Rel *garel)
i
=
1
;
foreach
(
r
,
join_rels
)
{
garel
[
i
]
=
*
(
Rel
*
)
lfirst
(
r
);
garel
[
i
]
=
*
(
Rel
OptInfo
*
)
lfirst
(
r
);
i
++
;
}
}
...
...
@@ -111,9 +111,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
else
if
(
number_of_joins
==
3
)
{
Rel
*
rel12
=
(
Rel
*
)
&
tmprel_array
[
1
][
2
];
Rel
*
rel13
=
(
Rel
*
)
&
tmprel_array
[
1
][
3
];
Rel
*
rel23
=
(
Rel
*
)
&
tmprel_array
[
2
][
3
];
Rel
OptInfo
*
rel12
=
(
RelOptInfo
*
)
&
tmprel_array
[
1
][
2
];
Rel
OptInfo
*
rel13
=
(
RelOptInfo
*
)
&
tmprel_array
[
1
][
3
];
Rel
OptInfo
*
rel23
=
(
RelOptInfo
*
)
&
tmprel_array
[
2
][
3
];
if
(
rel12
->
cheapestpath
->
path_cost
>
rel13
->
cheapestpath
->
path_cost
)
{
...
...
@@ -159,9 +159,9 @@ minspantree(Query *root, List *join_rels, Rel *garel)
if
(
connectto
[
tempn
]
!=
0
)
{
if
(
n
>
tempn
)
joinrel
=
(
Rel
*
)
&
tmprel_array
[
tempn
][
n
];
joinrel
=
(
Rel
OptInfo
*
)
&
tmprel_array
[
tempn
][
n
];
else
joinrel
=
(
Rel
*
)
&
tmprel_array
[
n
][
tempn
];
joinrel
=
(
Rel
OptInfo
*
)
&
tmprel_array
[
n
][
tempn
];
dist
=
joinrel
->
cheapestpath
->
path_cost
;
if
(
dist
<
disttoconnect
[
tempn
])
...
...
src/backend/optimizer/path/allpaths.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.1
6 1998/06/15 19:28:38
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.1
7 1998/07/18 04:22:29
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -105,7 +105,7 @@ static void
find_rel_paths
(
Query
*
root
,
List
*
rels
)
{
List
*
temp
;
Rel
*
rel
;
Rel
OptInfo
*
rel
;
List
*
lastpath
;
foreach
(
temp
,
rels
)
...
...
@@ -114,7 +114,7 @@ find_rel_paths(Query *root, List *rels)
List
*
rel_index_scan_list
;
List
*
or_index_scan_list
;
rel
=
(
Rel
*
)
lfirst
(
temp
);
rel
=
(
Rel
OptInfo
*
)
lfirst
(
temp
);
sequential_scan_list
=
lcons
(
create_seqscan_path
(
rel
),
NIL
);
...
...
@@ -175,7 +175,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
{
List
*
x
;
List
*
new_rels
=
NIL
;
Rel
*
rel
;
Rel
OptInfo
*
rel
;
/*******************************************
* genetic query optimizer entry point *
...
...
@@ -183,7 +183,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
*******************************************/
if
((
_use_geqo_
)
&&
length
(
root
->
base_relation_list_
)
>=
_use_geqo_rels_
)
return
lcons
(
geqo
(
root
),
NIL
);
/* returns *one* Rel, so lcons it */
return
lcons
(
geqo
(
root
),
NIL
);
/* returns *one* Rel
OptInfo
, so lcons it */
/*******************************************
* rest will be deprecated in case of GEQO *
...
...
@@ -212,7 +212,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
*/
if (XfuncMode != XFUNC_NOPULL && XfuncMode != XFUNC_OFF)
foreach(x, new_rels)
xfunc_trypullup((Rel *) lfirst(x));
xfunc_trypullup((Rel
OptInfo
*) lfirst(x));
#endif
prune_rel_paths
(
new_rels
);
...
...
@@ -231,7 +231,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
foreach
(
x
,
new_rels
)
{
rel
=
(
Rel
*
)
lfirst
(
x
);
rel
=
(
Rel
OptInfo
*
)
lfirst
(
x
);
if
(
rel
->
size
<=
0
)
rel
->
size
=
compute_rel_size
(
rel
);
rel
->
width
=
compute_rel_width
(
rel
);
...
...
@@ -399,7 +399,7 @@ print_path(Query *root, Path *path, int indent)
}
static
void
debug_print_rel
(
Query
*
root
,
Rel
*
rel
)
debug_print_rel
(
Query
*
root
,
Rel
OptInfo
*
rel
)
{
List
*
l
;
...
...
src/backend/optimizer/path/clausesel.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.
8 1998/06/15 19:28:39
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/clausesel.c,v 1.
9 1998/07/18 04:22:30
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -95,12 +95,12 @@ product_selec(List *clauseinfo_list)
void
set_rest_relselec
(
Query
*
root
,
List
*
rel_list
)
{
Rel
*
rel
;
Rel
OptInfo
*
rel
;
List
*
x
;
foreach
(
x
,
rel_list
)
{
rel
=
(
Rel
*
)
lfirst
(
x
);
rel
=
(
Rel
OptInfo
*
)
lfirst
(
x
);
set_rest_selec
(
root
,
rel
->
clauseinfo
);
}
}
...
...
src/backend/optimizer/path/costsize.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.2
1 1998/06/15 19:28:39
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/costsize.c,v 1.2
2 1998/07/18 04:22:31
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -360,7 +360,7 @@ cost_hashjoin(Cost outercost,
* Returns the size.
*/
int
compute_rel_size
(
Rel
*
rel
)
compute_rel_size
(
Rel
OptInfo
*
rel
)
{
Cost
temp
;
int
temp1
;
...
...
@@ -383,7 +383,7 @@ compute_rel_size(Rel *rel)
* Returns the width of the tuple as a fixnum.
*/
int
compute_rel_width
(
Rel
*
rel
)
compute_rel_width
(
Rel
OptInfo
*
rel
)
{
return
(
compute_targetlist_width
(
get_actual_tlist
(
rel
->
targetlist
)));
}
...
...
src/backend/optimizer/path/indxpath.c
View file @
584f9438
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.1
6 1998/06/15 19:28:40
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.1
7 1998/07/18 04:22:31
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -42,22 +42,22 @@
static
void
match_index_orclauses
(
Rel
*
rel
,
Rel
*
index
,
int
indexkey
,
match_index_orclauses
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
int
indexkey
,
int
xclass
,
List
*
clauseinfo_list
);
static
bool
match_index_to_operand
(
int
indexkey
,
Expr
*
operand
,
Rel
*
rel
,
Rel
*
index
);
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
);
static
List
*
match_index_orclause
(
Rel
*
rel
,
Rel
*
index
,
int
indexkey
,
match_index_orclause
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
int
indexkey
,
int
xclass
,
List
*
or_clauses
,
List
*
other_matching_indices
);
static
List
*
group_clauses_by_indexkey
(
Rel
*
rel
,
Rel
*
index
,
group_clauses_by_indexkey
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
int
*
indexkeys
,
Oid
*
classes
,
List
*
clauseinfo_list
);
static
List
*
group_clauses_by_ikey_for_joins
(
Rel
*
rel
,
Rel
*
index
,
group_clauses_by_ikey_for_joins
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
int
*
indexkeys
,
Oid
*
classes
,
List
*
join_cinfo_list
,
List
*
restr_cinfo_list
);
static
CInfo
*
match_clause_to_indexkey
(
Rel
*
rel
,
Rel
*
index
,
int
indexkey
,
match_clause_to_indexkey
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
int
indexkey
,
int
xclass
,
CInfo
*
clauseInfo
,
bool
join
);
static
bool
pred_test
(
List
*
predicate_list
,
List
*
clauseinfo_list
,
...
...
@@ -67,17 +67,17 @@ static bool one_pred_clause_expr_test(Expr *predicate, Node *clause);
static
bool
one_pred_clause_test
(
Expr
*
predicate
,
Node
*
clause
);
static
bool
clause_pred_clause_test
(
Expr
*
predicate
,
Node
*
clause
);
static
List
*
indexable_joinclauses
(
Rel
*
rel
,
Rel
*
index
,
indexable_joinclauses
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
List
*
joininfo_list
,
List
*
clauseinfo_list
);
static
List
*
index_innerjoin
(
Query
*
root
,
Rel
*
rel
,
List
*
clausegroup_list
,
Rel
*
index
);
index_innerjoin
(
Query
*
root
,
Rel
OptInfo
*
rel
,
List
*
clausegroup_list
,
Rel
OptInfo
*
index
);
static
List
*
create_index_paths
(
Query
*
root
,
Rel
*
rel
,
Rel
*
index
,
create_index_paths
(
Query
*
root
,
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
List
*
clausegroup_list
,
bool
join
);
static
List
*
add_index_paths
(
List
*
indexpaths
,
List
*
new_indexpaths
);
static
bool
function_index_operand
(
Expr
*
funcOpnd
,
Rel
*
rel
,
Rel
*
index
);
static
bool
SingleAttributeIndex
(
Rel
*
index
);
static
bool
function_index_operand
(
Expr
*
funcOpnd
,
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
);
static
bool
SingleAttributeIndex
(
Rel
OptInfo
*
index
);
/* If Spyros can use a constant PRS2_BOOL_TYPEID, I can use this */
#define BOOL_TYPEID ((Oid) 16)
...
...
@@ -110,14 +110,14 @@ static bool SingleAttributeIndex(Rel *index);
*/
List
*
find_index_paths
(
Query
*
root
,
Rel
*
rel
,
Rel
OptInfo
*
rel
,
List
*
indices
,
List
*
clauseinfo_list
,
List
*
joininfo_list
)
{
List
*
scanclausegroups
=
NIL
;
List
*
scanpaths
=
NIL
;
Rel
*
index
=
(
Rel
*
)
NULL
;
Rel
OptInfo
*
index
=
(
RelOptInfo
*
)
NULL
;
List
*
joinclausegroups
=
NIL
;
List
*
joinpaths
=
NIL
;
List
*
retval
=
NIL
;
...
...
@@ -125,7 +125,7 @@ find_index_paths(Query *root,
if
(
indices
==
NIL
)
return
(
NULL
);
index
=
(
Rel
*
)
lfirst
(
indices
);
index
=
(
Rel
OptInfo
*
)
lfirst
(
indices
);
retval
=
find_index_paths
(
root
,
rel
,
...
...
@@ -235,8 +235,8 @@ find_index_paths(Query *root,
*
*/
static
void
match_index_orclauses
(
Rel
*
rel
,
Rel
*
index
,
match_index_orclauses
(
Rel
OptInfo
*
rel
,
Rel
OptInfo
*
index
,
int
indexkey
,
int
xclass
,
List
*
clauseinfo_list
)
...
...
@@ -273,8 +273,8 @@ match_index_orclauses(Rel *rel,
static
bool
match_index_to_operand
(
int
indexkey
,
Expr
*
operand
,
Rel
*
rel
,
Rel
*
index
)
Rel
OptInfo
*
rel
,
Rel
OptInfo
*
index
)
{
/*
...
...
@@ -311,8 +311,8 @@ match_index_to_operand(int indexkey,
* match the third, g,h match the fourth, etc.
*/
static
List
*
match_index_orclause
(
Rel
*
rel
,
Rel
*
index
,
match_index_orclause
(
Rel
OptInfo
*
rel
,
Rel
OptInfo
*
index
,
int
indexkey
,
int
xclass
,
List
*
or_clauses
,
...
...
@@ -393,8 +393,8 @@ match_index_orclause(Rel *rel,
*
*/
static
List
*
group_clauses_by_indexkey
(
Rel
*
rel
,
Rel
*
index
,
group_clauses_by_indexkey
(
Rel
OptInfo
*
rel
,
Rel
OptInfo
*
index
,
int
*
indexkeys
,
Oid
*
classes
,
List
*
clauseinfo_list
)
...
...
@@ -455,8 +455,8 @@ group_clauses_by_indexkey(Rel *rel,
*
*/
static
List
*
group_clauses_by_ikey_for_joins
(
Rel
*
rel
,
Rel
*
index
,
group_clauses_by_ikey_for_joins
(
Rel
OptInfo
*
rel
,
Rel
OptInfo
*
index
,
int
*
indexkeys
,
Oid
*
classes
,
List
*
join_cinfo_list
,
...
...
@@ -578,8 +578,8 @@ group_clauses_by_ikey_for_joins(Rel *rel,
*
*/
static
CInfo
*
match_clause_to_indexkey
(
Rel
*
rel
,
Rel
*
index
,
match_clause_to_indexkey
(
Rel
OptInfo
*
rel
,
Rel
OptInfo
*
index
,
int
indexkey
,
int
xclass
,
CInfo
*
clauseInfo
,
...
...
@@ -1102,7 +1102,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
*
*/
static
List
*
indexable_joinclauses
(
Rel
*
rel
,
Rel
*
index
,
indexable_joinclauses
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
List
*
joininfo_list
,
List
*
clauseinfo_list
)
{
JInfo
*
joininfo
=
(
JInfo
*
)
NULL
;
...
...
@@ -1176,7 +1176,7 @@ extract_restrict_clauses(List *clausegroup)
*
*/
static
List
*
index_innerjoin
(
Query
*
root
,
Rel
*
rel
,
List
*
clausegroup_list
,
Rel
*
index
)
index_innerjoin
(
Query
*
root
,
Rel
OptInfo
*
rel
,
List
*
clausegroup_list
,
RelOptInfo
*
index
)
{
List
*
clausegroup
=
NIL
;
List
*
cg_list
=
NIL
;
...
...
@@ -1262,8 +1262,8 @@ index_innerjoin(Query *root, Rel *rel, List *clausegroup_list, Rel *index)
*/
static
List
*
create_index_paths
(
Query
*
root
,
Rel
*
rel
,
Rel
*
index
,
Rel
OptInfo
*
rel
,
Rel
OptInfo
*
index
,
List
*
clausegroup_list
,
bool
join
)
{
...
...
@@ -1308,7 +1308,7 @@ add_index_paths(List *indexpaths, List *new_indexpaths)
}
static
bool
function_index_operand
(
Expr
*
funcOpnd
,
Rel
*
rel
,
Rel
*
index
)
function_index_operand
(
Expr
*
funcOpnd
,
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
)
{
Oid
heapRelid
=
(
Oid
)
lfirsti
(
rel
->
relids
);
Func
*
function
;
...
...
@@ -1368,7 +1368,7 @@ function_index_operand(Expr *funcOpnd, Rel *rel, Rel *index)
}
static
bool
SingleAttributeIndex
(
Rel
*
index
)
SingleAttributeIndex
(
Rel
OptInfo
*
index
)
{
/*
...
...
src/backend/optimizer/path/joinpath.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.
6 1998/06/15 19:28:40
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinpath.c,v 1.
7 1998/07/18 04:22:32
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -31,18 +31,18 @@
static
Path
*
best_innerjoin
(
List
*
join_paths
,
List
*
outer_relid
);
static
List
*
sort_inner_and_outer
(
Rel
*
joinrel
,
Rel
*
outerrel
,
Rel
*
innerrel
,
sort_inner_and_outer
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outerrel
,
RelOptInfo
*
innerrel
,
List
*
mergeinfo_list
);
static
List
*
match_unsorted_outer
(
Rel
*
joinrel
,
Rel
*
outerrel
,
Rel
*
innerrel
,
match_unsorted_outer
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outerrel
,
RelOptInfo
*
innerrel
,
List
*
outerpath_list
,
Path
*
cheapest_inner
,
Path
*
best_innerjoin
,
List
*
mergeinfo_list
);
static
List
*
match_unsorted_inner
(
Rel
*
joinrel
,
Rel
*
outerrel
,
Rel
*
innerrel
,
match_unsorted_inner
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outerrel
,
RelOptInfo
*
innerrel
,
List
*
innerpath_list
,
List
*
mergeinfo_list
);
static
bool
EnoughMemoryForHashjoin
(
Rel
*
hashrel
);
static
bool
EnoughMemoryForHashjoin
(
Rel
OptInfo
*
hashrel
);
static
List
*
hash_inner_and_outer
(
Rel
*
joinrel
,
Rel
*
outerrel
,
Rel
*
innerrel
,
hash_inner_and_outer
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outerrel
,
RelOptInfo
*
innerrel
,
List
*
hashinfo_list
);
/*
...
...
@@ -76,11 +76,11 @@ find_all_join_paths(Query *root, List *joinrels)
while
(
joinrels
!=
NIL
)
{
Rel
*
joinrel
=
(
Rel
*
)
lfirst
(
joinrels
);
Rel
OptInfo
*
joinrel
=
(
RelOptInfo
*
)
lfirst
(
joinrels
);
List
*
innerrelids
;
List
*
outerrelids
;
Rel
*
innerrel
;
Rel
*
outerrel
;
Rel
OptInfo
*
innerrel
;
Rel
OptInfo
*
outerrel
;
Path
*
bestinnerjoin
;
List
*
pathlist
=
NIL
;
...
...
@@ -238,9 +238,9 @@ best_innerjoin(List *join_paths, List *outer_relids)
* Returns a list of mergesort paths.
*/
static
List
*
sort_inner_and_outer
(
Rel
*
joinrel
,
Rel
*
outerrel
,
Rel
*
innerrel
,
sort_inner_and_outer
(
Rel
OptInfo
*
joinrel
,
Rel
OptInfo
*
outerrel
,
Rel
OptInfo
*
innerrel
,
List
*
mergeinfo_list
)
{
List
*
ms_list
=
NIL
;
...
...
@@ -316,9 +316,9 @@ sort_inner_and_outer(Rel *joinrel,
* Returns a list of possible join path nodes.
*/
static
List
*
match_unsorted_outer
(
Rel
*
joinrel
,
Rel
*
outerrel
,
Rel
*
innerrel
,
match_unsorted_outer
(
Rel
OptInfo
*
joinrel
,
Rel
OptInfo
*
outerrel
,
Rel
OptInfo
*
innerrel
,
List
*
outerpath_list
,
Path
*
cheapest_inner
,
Path
*
best_innerjoin
,
...
...
@@ -469,9 +469,9 @@ match_unsorted_outer(Rel *joinrel,
* Returns a list of possible merge paths.
*/
static
List
*
match_unsorted_inner
(
Rel
*
joinrel
,
Rel
*
outerrel
,
Rel
*
innerrel
,
match_unsorted_inner
(
Rel
OptInfo
*
joinrel
,
Rel
OptInfo
*
outerrel
,
Rel
OptInfo
*
innerrel
,
List
*
innerpath_list
,
List
*
mergeinfo_list
)
{
...
...
@@ -565,7 +565,7 @@ match_unsorted_inner(Rel *joinrel,
}
static
bool
EnoughMemoryForHashjoin
(
Rel
*
hashrel
)
EnoughMemoryForHashjoin
(
Rel
OptInfo
*
hashrel
)
{
int
ntuples
;
int
tupsize
;
...
...
@@ -599,9 +599,9 @@ EnoughMemoryForHashjoin(Rel *hashrel)
* Returns a list of hashjoin paths.
*/
static
List
*
hash_inner_and_outer
(
Rel
*
joinrel
,
Rel
*
outerrel
,
Rel
*
innerrel
,
hash_inner_and_outer
(
Rel
OptInfo
*
joinrel
,
Rel
OptInfo
*
outerrel
,
Rel
OptInfo
*
innerrel
,
List
*
hashinfo_list
)
{
HInfo
*
xhashinfo
=
(
HInfo
*
)
NULL
;
...
...
src/backend/optimizer/path/joinrels.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.1
0 1998/06/15 19:28:40
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.1
1 1998/07/18 04:22:33
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -31,18 +31,18 @@ bool _use_right_sided_plans_ = false;
#endif
static
List
*
find_clause_joins
(
Query
*
root
,
Rel
*
outer_rel
,
List
*
joininfo_list
);
static
List
*
find_clauseless_joins
(
Rel
*
outer_rel
,
List
*
inner_rels
);
static
Rel
*
init_join_rel
(
Rel
*
outer_rel
,
Rel
*
inner_rel
,
JInfo
*
joininfo
);
static
List
*
find_clause_joins
(
Query
*
root
,
Rel
OptInfo
*
outer_rel
,
List
*
joininfo_list
);
static
List
*
find_clauseless_joins
(
Rel
OptInfo
*
outer_rel
,
List
*
inner_rels
);
static
Rel
OptInfo
*
init_join_rel
(
RelOptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
,
JInfo
*
joininfo
);
static
List
*
new_join_tlist
(
List
*
tlist
,
List
*
other_relids
,
int
first_resdomno
);
static
List
*
new_joininfo_list
(
List
*
joininfo_list
,
List
*
join_relids
);
static
void
add_superrels
(
Rel
*
rel
,
Rel
*
super_rel
);
static
bool
nonoverlap_rels
(
Rel
*
rel1
,
Rel
*
rel2
);
static
void
add_superrels
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
super_rel
);
static
bool
nonoverlap_rels
(
Rel
OptInfo
*
rel1
,
RelOptInfo
*
rel2
);
static
bool
nonoverlap_sets
(
List
*
s1
,
List
*
s2
);
static
void
set_joinrel_size
(
Rel
*
joinrel
,
Rel
*
outer_rel
,
Rel
*
inner_rel
,
set_joinrel_size
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
,
JInfo
*
jinfo
);
/*
...
...
@@ -67,7 +67,7 @@ find_join_rels(Query *root, List *outer_rels)
foreach
(
r
,
outer_rels
)
{
Rel
*
outer_rel
=
(
Rel
*
)
lfirst
(
r
);
Rel
OptInfo
*
outer_rel
=
(
RelOptInfo
*
)
lfirst
(
r
);
if
(
!
(
joins
=
find_clause_joins
(
root
,
outer_rel
,
outer_rel
->
joininfo
)))
{
...
...
@@ -99,7 +99,7 @@ find_join_rels(Query *root, List *outer_rels)
* Returns a list of new join relations.
*/
static
List
*
find_clause_joins
(
Query
*
root
,
Rel
*
outer_rel
,
List
*
joininfo_list
)
find_clause_joins
(
Query
*
root
,
Rel
OptInfo
*
outer_rel
,
List
*
joininfo_list
)
{
List
*
join_list
=
NIL
;
List
*
i
=
NIL
;
...
...
@@ -107,7 +107,7 @@ find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
foreach
(
i
,
joininfo_list
)
{
JInfo
*
joininfo
=
(
JInfo
*
)
lfirst
(
i
);
Rel
*
rel
;
Rel
OptInfo
*
rel
;
if
(
!
joininfo
->
inactive
)
{
...
...
@@ -158,16 +158,16 @@ find_clause_joins(Query *root, Rel *outer_rel, List *joininfo_list)
* Returns a list of new join relations.
*/
static
List
*
find_clauseless_joins
(
Rel
*
outer_rel
,
List
*
inner_rels
)
find_clauseless_joins
(
Rel
OptInfo
*
outer_rel
,
List
*
inner_rels
)
{
Rel
*
inner_rel
;
Rel
OptInfo
*
inner_rel
;
List
*
t_list
=
NIL
;
List
*
temp_node
=
NIL
;
List
*
i
=
NIL
;
foreach
(
i
,
inner_rels
)
{
inner_rel
=
(
Rel
*
)
lfirst
(
i
);
inner_rel
=
(
Rel
OptInfo
*
)
lfirst
(
i
);
if
(
nonoverlap_rels
(
inner_rel
,
outer_rel
))
{
temp_node
=
lcons
(
init_join_rel
(
outer_rel
,
...
...
@@ -192,10 +192,10 @@ find_clauseless_joins(Rel *outer_rel, List *inner_rels)
*
* Returns the new join relation node.
*/
static
Rel
*
init_join_rel
(
Rel
*
outer_rel
,
Rel
*
inner_rel
,
JInfo
*
joininfo
)
static
Rel
OptInfo
*
init_join_rel
(
Rel
OptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
,
JInfo
*
joininfo
)
{
Rel
*
joinrel
=
makeNode
(
Rel
);
Rel
OptInfo
*
joinrel
=
makeNode
(
RelOptInfo
);
List
*
joinrel_joininfo_list
=
NIL
;
List
*
new_outer_tlist
;
List
*
new_inner_tlist
;
...
...
@@ -396,19 +396,19 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach
(
xjoinrel
,
joinrels
)
{
Rel
*
joinrel
=
(
Rel
*
)
lfirst
(
xjoinrel
);
Rel
OptInfo
*
joinrel
=
(
RelOptInfo
*
)
lfirst
(
xjoinrel
);
foreach
(
xrelid
,
joinrel
->
relids
)
{
Relid
relid
=
(
Relid
)
lfirst
(
xrelid
);
Rel
*
rel
=
get_join_rel
(
root
,
relid
);
Rel
OptInfo
*
rel
=
get_join_rel
(
root
,
relid
);
add_superrels
(
rel
,
joinrel
);
}
}
foreach
(
xjoinrel
,
joinrels
)
{
Rel
*
joinrel
=
(
Rel
*
)
lfirst
(
xjoinrel
);
Rel
OptInfo
*
joinrel
=
(
RelOptInfo
*
)
lfirst
(
xjoinrel
);
foreach
(
xjoininfo
,
joinrel
->
joininfo
)
{
...
...
@@ -421,7 +421,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach
(
xrelid
,
other_rels
)
{
Relid
relid
=
(
Relid
)
lfirst
(
xrelid
);
Rel
*
rel
=
get_join_rel
(
root
,
relid
);
Rel
OptInfo
*
rel
=
get_join_rel
(
root
,
relid
);
List
*
super_rels
=
rel
->
superrels
;
List
*
xsuper_rel
=
NIL
;
JInfo
*
new_joininfo
=
makeNode
(
JInfo
);
...
...
@@ -436,7 +436,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
foreach
(
xsuper_rel
,
super_rels
)
{
Rel
*
super_rel
=
(
Rel
*
)
lfirst
(
xsuper_rel
);
Rel
OptInfo
*
super_rel
=
(
RelOptInfo
*
)
lfirst
(
xsuper_rel
);
if
(
nonoverlap_rels
(
super_rel
,
joinrel
))
{
...
...
@@ -471,7 +471,7 @@ add_new_joininfos(Query *root, List *joinrels, List *outerrels)
}
foreach
(
xrel
,
outerrels
)
{
Rel
*
rel
=
(
Rel
*
)
lfirst
(
xrel
);
Rel
OptInfo
*
rel
=
(
RelOptInfo
*
)
lfirst
(
xrel
);
rel
->
superrels
=
NIL
;
}
...
...
@@ -499,7 +499,7 @@ final_join_rels(List *join_rel_list)
*/
foreach
(
xrel
,
join_rel_list
)
{
Rel
*
rel
=
(
Rel
*
)
lfirst
(
xrel
);
Rel
OptInfo
*
rel
=
(
RelOptInfo
*
)
lfirst
(
xrel
);
List
*
xjoininfo
=
NIL
;
bool
final
=
true
;
...
...
@@ -533,7 +533,7 @@ final_join_rels(List *join_rel_list)
* Modifies the superrels field of rel
*/
static
void
add_superrels
(
Rel
*
rel
,
Rel
*
super_rel
)
add_superrels
(
Rel
OptInfo
*
rel
,
RelOptInfo
*
super_rel
)
{
rel
->
superrels
=
lappend
(
rel
->
superrels
,
super_rel
);
}
...
...
@@ -548,7 +548,7 @@ add_superrels(Rel *rel, Rel *super_rel)
* Returns non-nil if rel1 and rel2 do not overlap.
*/
static
bool
nonoverlap_rels
(
Rel
*
rel1
,
Rel
*
rel2
)
nonoverlap_rels
(
Rel
OptInfo
*
rel1
,
RelOptInfo
*
rel2
)
{
return
(
nonoverlap_sets
(
rel1
->
relids
,
rel2
->
relids
));
}
...
...
@@ -569,7 +569,7 @@ nonoverlap_sets(List *s1, List *s2)
}
static
void
set_joinrel_size
(
Rel
*
joinrel
,
Rel
*
outer_rel
,
Rel
*
inner_rel
,
JInfo
*
jinfo
)
set_joinrel_size
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outer_rel
,
RelOptInfo
*
inner_rel
,
JInfo
*
jinfo
)
{
int
ntuples
;
float
selec
;
...
...
src/backend/optimizer/path/orindxpath.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.
6 1998/06/15 19:28:41
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.
7 1998/07/18 04:22:33
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -32,11 +32,11 @@
static
void
best_or_subclause_indices
(
Query
*
root
,
Rel
*
rel
,
List
*
subclauses
,
best_or_subclause_indices
(
Query
*
root
,
Rel
OptInfo
*
rel
,
List
*
subclauses
,
List
*
indices
,
List
*
examined_indexids
,
Cost
subcost
,
List
*
selectivities
,
List
**
indexids
,
Cost
*
cost
,
List
**
selecs
);
static
void
best_or_subclause_index
(
Query
*
root
,
Rel
*
rel
,
Expr
*
subclause
,
best_or_subclause_index
(
Query
*
root
,
Rel
OptInfo
*
rel
,
Expr
*
subclause
,
List
*
indices
,
int
*
indexid
,
Cost
*
cost
,
Cost
*
selec
);
...
...
@@ -52,7 +52,7 @@ best_or_subclause_index(Query *root, Rel *rel, Expr *subclause,
*/
List
*
create_or_index_paths
(
Query
*
root
,
Rel
*
rel
,
List
*
clauses
)
Rel
OptInfo
*
rel
,
List
*
clauses
)
{
List
*
t_list
=
NIL
;
...
...
@@ -157,7 +157,7 @@ create_or_index_paths(Query *root,
*/
static
void
best_or_subclause_indices
(
Query
*
root
,
Rel
*
rel
,
Rel
OptInfo
*
rel
,
List
*
subclauses
,
List
*
indices
,
List
*
examined_indexids
,
...
...
@@ -212,7 +212,7 @@ best_or_subclause_indices(Query *root,
*/
static
void
best_or_subclause_index
(
Query
*
root
,
Rel
*
rel
,
Rel
OptInfo
*
rel
,
Expr
*
subclause
,
List
*
indices
,
int
*
retIndexid
,
/* return value */
...
...
@@ -224,7 +224,7 @@ best_or_subclause_index(Query *root,
Datum
value
;
int
flag
=
0
;
Cost
subcost
;
Rel
*
index
=
(
Rel
*
)
lfirst
(
indices
);
Rel
OptInfo
*
index
=
(
RelOptInfo
*
)
lfirst
(
indices
);
AttrNumber
attno
=
(
get_leftop
(
subclause
))
->
varattno
;
Oid
opno
=
((
Oper
*
)
subclause
->
oper
)
->
opno
;
bool
constant_on_right
=
non_null
((
Expr
*
)
get_rightop
(
subclause
));
...
...
src/backend/optimizer/path/prune.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.1
4 1998/06/15 19:28:41
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.1
5 1998/07/18 04:22:34
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -24,7 +24,7 @@
#include "utils/elog.h"
static
List
*
prune_joinrel
(
Rel
*
rel
,
List
*
other_rels
);
static
List
*
prune_joinrel
(
Rel
OptInfo
*
rel
,
List
*
other_rels
);
/*
* prune-joinrels--
...
...
@@ -44,7 +44,7 @@ prune_joinrels(List *rel_list)
* deleted
*/
foreach
(
i
,
rel_list
)
lnext
(
i
)
=
prune_joinrel
((
Rel
*
)
lfirst
(
i
),
lnext
(
i
));
lnext
(
i
)
=
prune_joinrel
((
Rel
OptInfo
*
)
lfirst
(
i
),
lnext
(
i
));
}
/*
...
...
@@ -59,14 +59,14 @@ prune_joinrels(List *rel_list)
*
*/
static
List
*
prune_joinrel
(
Rel
*
rel
,
List
*
other_rels
)
prune_joinrel
(
Rel
OptInfo
*
rel
,
List
*
other_rels
)
{
List
*
i
=
NIL
;
List
*
result
=
NIL
;
foreach
(
i
,
other_rels
)
{
Rel
*
other_rel
=
(
Rel
*
)
lfirst
(
i
);
Rel
OptInfo
*
other_rel
=
(
RelOptInfo
*
)
lfirst
(
i
);
if
(
same
(
rel
->
relids
,
other_rel
->
relids
))
{
...
...
@@ -96,12 +96,12 @@ prune_rel_paths(List *rel_list)
List
*
x
=
NIL
;
List
*
y
=
NIL
;
Path
*
path
=
NULL
;
Rel
*
rel
=
(
Rel
*
)
NULL
;
Rel
OptInfo
*
rel
=
(
RelOptInfo
*
)
NULL
;
JoinPath
*
cheapest
=
(
JoinPath
*
)
NULL
;
foreach
(
x
,
rel_list
)
{
rel
=
(
Rel
*
)
lfirst
(
x
);
rel
=
(
Rel
OptInfo
*
)
lfirst
(
x
);
rel
->
size
=
0
;
foreach
(
y
,
rel
->
pathlist
)
{
...
...
@@ -130,7 +130,7 @@ prune_rel_paths(List *rel_list)
*
*/
Path
*
prune_rel_path
(
Rel
*
rel
,
Path
*
unorderedpath
)
prune_rel_path
(
Rel
OptInfo
*
rel
,
Path
*
unorderedpath
)
{
Path
*
cheapest
=
set_cheapest
(
rel
,
rel
->
pathlist
);
...
...
@@ -165,7 +165,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
foreach
(
xrel
,
rel_list1
)
{
Rel
*
rel
=
(
Rel
*
)
lfirst
(
xrel
);
Rel
OptInfo
*
rel
=
(
RelOptInfo
*
)
lfirst
(
xrel
);
rel_list2
=
prune_joinrel
(
rel
,
rel_list2
);
}
...
...
@@ -187,7 +187,7 @@ merge_joinrels(List *rel_list1, List *rel_list2)
List
*
prune_oldrels
(
List
*
old_rels
)
{
Rel
*
rel
;
Rel
OptInfo
*
rel
;
List
*
joininfo_list
,
*
xjoininfo
,
*
i
,
...
...
@@ -195,7 +195,7 @@ prune_oldrels(List *old_rels)
foreach
(
i
,
old_rels
)
{
rel
=
(
Rel
*
)
lfirst
(
i
);
rel
=
(
Rel
OptInfo
*
)
lfirst
(
i
);
joininfo_list
=
rel
->
joininfo
;
if
(
joininfo_list
==
NIL
)
...
...
src/backend/optimizer/path/xfunc.c
View file @
584f9438
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.1
5 1998/06/15 19:28:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/xfunc.c,v 1.1
6 1998/07/18 04:22:34
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -57,7 +57,7 @@ xfunc_card_unreferenced(Query *queryInfo,
*/
void
xfunc_trypullup
(
Rel
rel
)
xfunc_trypullup
(
Rel
OptInfo
rel
)
{
LispValue
y
;
/* list ptr */
CInfo
maxcinfo
;
/* The CInfo to pull up, as calculated by
...
...
@@ -242,7 +242,7 @@ xfunc_shouldpull(Query *queryInfo,
/*
* * we've left an expensive restriction below a join. Since *
* we may pullup this restriction in predmig.c, we'd best *
* set the Rel of this join to be unpruneable
* set the Rel
OptInfo
of this join to be unpruneable
*/
set_pruneable
(
get_parent
(
parentpath
),
false
);
/* and fall through */
...
...
@@ -256,8 +256,8 @@ xfunc_shouldpull(Query *queryInfo,
** xfunc_pullup --
** move clause from child pathnode to parent pathnode. This operation
** makes the child pathnode produce a larger relation than it used to.
** This means that we must construct a new Rel just for the childpath,
** although this Rel will not be added to the list of Rels to be joined up
** This means that we must construct a new Rel
OptInfo
just for the childpath,
** although this Rel
OptInfo
will not be added to the list of Rels to be joined up
** in the query; it's merely a parent for the new childpath.
** We also have to fix up the path costs of the child and parent.
**
...
...
@@ -272,7 +272,7 @@ xfunc_pullup(Query *queryInfo,
int
clausetype
)
/* whether clause to pull is join or local */
{
Path
newkid
;
Rel
newrel
;
Rel
OptInfo
newrel
;
Cost
pulled_selec
;
Cost
cost
;
CInfo
newinfo
;
...
...
@@ -294,7 +294,7 @@ xfunc_pullup(Query *queryInfo,
}
/*
* * give the new child path its own Rel node that reflects the * lack
* * give the new child path its own Rel
OptInfo
node that reflects the * lack
* of the pulled-up predicate
*/
pulled_selec
=
compute_clause_selec
(
queryInfo
,
...
...
@@ -400,7 +400,7 @@ xfunc_join_expense(Query *queryInfo, JoinPath path, int whichchild)
/*
* * the second argument to xfunc_card_unreferenced reflects all the *
* relations involved in the join clause, i.e. all the relids in the
* Rel * of the join clause
* Rel
OptInfo
* of the join clause
*/
Count
card
=
0
;
Cost
cost
=
xfunc_expense_per_tuple
(
path
,
whichchild
);
...
...
@@ -736,9 +736,9 @@ xfunc_card_unreferenced(Query *queryInfo,
/* find all relids of base relations referenced in query */
foreach
(
temp
,
queryInfo
->
base_relation_list_
)
{
Assert
(
lnext
(
get_relids
((
Rel
)
lfirst
(
temp
)))
==
LispNil
);
Assert
(
lnext
(
get_relids
((
Rel
OptInfo
)
lfirst
(
temp
)))
==
LispNil
);
allrelids
=
lappend
(
allrelids
,
lfirst
(
get_relids
((
Rel
)
lfirst
(
temp
))));
lfirst
(
get_relids
((
Rel
OptInfo
)
lfirst
(
temp
))));
}
/* find all relids referenced in query but not in clause */
...
...
@@ -758,7 +758,7 @@ xfunc_card_product(Query *queryInfo, Relid relids)
{
LispValue
cinfonode
;
LispValue
temp
;
Rel
currel
;
Rel
OptInfo
currel
;
Cost
tuples
;
Count
retval
=
0
;
...
...
@@ -1095,8 +1095,8 @@ xfunc_total_path_cost(JoinPath pathnode)
Cost
xfunc_expense_per_tuple
(
JoinPath
joinnode
,
int
whichchild
)
{
Rel
outerrel
=
get_parent
((
Path
)
get_outerjoinpath
(
joinnode
));
Rel
innerrel
=
get_parent
((
Path
)
get_innerjoinpath
(
joinnode
));
Rel
OptInfo
outerrel
=
get_parent
((
Path
)
get_outerjoinpath
(
joinnode
));
Rel
OptInfo
innerrel
=
get_parent
((
Path
)
get_innerjoinpath
(
joinnode
));
Count
outerwidth
=
get_width
(
outerrel
);
Count
outers_per_page
=
ceil
(
BLCKSZ
/
(
outerwidth
+
sizeof
(
HeapTupleData
)));
...
...
@@ -1133,11 +1133,11 @@ xfunc_expense_per_tuple(JoinPath joinnode, int whichchild)
** nodes to point to the correct varno (either INNER or OUTER, depending
** on which child the clause was pulled from), and the right varattno in the
** target list of the child's former relation. If the target list of the
** child Rel does not contain the attribute we need, we add it.
** child Rel
OptInfo
does not contain the attribute we need, we add it.
*/
void
xfunc_fixvars
(
LispValue
clause
,
/* clause being pulled up */
Rel
rel
,
/* rel it's being pulled from */
Rel
OptInfo
rel
,
/* rel it's being pulled from */
int
varno
)
/* whether rel is INNER or OUTER of join */
{
LispValue
tmpclause
;
/* temporary variable */
...
...
@@ -1426,9 +1426,9 @@ do { \
** Just like _copyRel, but doesn't copy the paths
*/
bool
xfunc_copyrel
(
Rel
from
,
Rel
*
to
)
xfunc_copyrel
(
Rel
OptInfo
from
,
RelOptInfo
*
to
)
{
Rel
newnode
;
Rel
OptInfo
newnode
;
Pointer
(
*
alloc
)
()
=
palloc
;
...
...
@@ -1444,7 +1444,7 @@ xfunc_copyrel(Rel from, Rel *to)
}
/* COPY_NEW(c) */
newnode
=
(
Rel
)
(
*
alloc
)
(
classSize
(
Rel
));
newnode
=
(
Rel
OptInfo
)
(
*
alloc
)
(
classSize
(
RelOptInfo
));
if
(
newnode
==
NULL
)
return
false
;
...
...
src/backend/optimizer/plan/createplan.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.2
8 1998/06/15 19:28:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/createplan.c,v 1.2
9 1998/07/18 04:22:36
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -106,7 +106,7 @@ create_plan(Path *best_path)
{
List
*
tlist
;
Plan
*
plan_node
=
(
Plan
*
)
NULL
;
Rel
*
parent_rel
;
Rel
OptInfo
*
parent_rel
;
int
size
;
int
width
;
int
pages
;
...
...
src/backend/optimizer/plan/initsplan.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.1
2 1998/06/15 19:28:43
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.1
3 1998/07/18 04:22:37
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -79,7 +79,7 @@ initialize_base_rels_list(Query *root, List *tlist)
{
Var
*
var
;
Index
varno
;
Rel
*
result
;
Rel
OptInfo
*
result
;
var
=
(
Var
*
)
lfirst
(
tvar
);
varno
=
var
->
varno
;
...
...
@@ -108,7 +108,7 @@ add_missing_vars_to_base_rels(Query *root, List *tlist)
{
RangeTblEntry
*
rte
=
(
RangeTblEntry
*
)
lfirst
(
l
);
List
*
relids
;
Rel
*
result
;
Rel
OptInfo
*
result
;
Var
*
var
;
relids
=
lconsi
(
varno
,
NIL
);
...
...
@@ -187,7 +187,7 @@ add_clause_to_rels(Query *root, List *clause)
if
(
length
(
relids
)
==
1
)
{
Rel
*
rel
=
get_base_rel
(
root
,
lfirsti
(
relids
));
Rel
OptInfo
*
rel
=
get_base_rel
(
root
,
lfirsti
(
relids
));
/*
* There is only one relation participating in 'clause', so
...
...
@@ -302,7 +302,7 @@ add_vars_to_rels(Query *root, List *vars, List *join_relids)
{
Var
*
var
;
List
*
temp
=
NIL
;
Rel
*
rel
=
(
Rel
*
)
NULL
;
Rel
OptInfo
*
rel
=
(
RelOptInfo
*
)
NULL
;
TargetEntry
*
tlistentry
;
foreach
(
temp
,
vars
)
...
...
@@ -337,14 +337,14 @@ initialize_join_clause_info(List *rel_list)
List
*
x
,
*
y
,
*
z
;
Rel
*
rel
;
Rel
OptInfo
*
rel
;
JInfo
*
joininfo
;
CInfo
*
clauseinfo
;
Expr
*
clause
;
foreach
(
x
,
rel_list
)
{
rel
=
(
Rel
*
)
lfirst
(
x
);
rel
=
(
Rel
OptInfo
*
)
lfirst
(
x
);
foreach
(
y
,
rel
->
joininfo
)
{
joininfo
=
(
JInfo
*
)
lfirst
(
y
);
...
...
src/backend/optimizer/plan/planmain.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.2
2 1998/06/15 19:28:44
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planmain.c,v 1.2
3 1998/07/18 04:22:37
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -250,7 +250,7 @@ subplanner(Query *root,
List
*
flat_tlist
,
List
*
qual
)
{
Rel
*
final_relation
;
Rel
OptInfo
*
final_relation
;
List
*
final_relation_list
;
/*
...
...
@@ -274,9 +274,9 @@ subplanner(Query *root,
root
->
base_relation_list_
);
if
(
final_relation_list
)
final_relation
=
(
Rel
*
)
lfirst
(
final_relation_list
);
final_relation
=
(
Rel
OptInfo
*
)
lfirst
(
final_relation_list
);
else
final_relation
=
(
Rel
*
)
NIL
;
final_relation
=
(
Rel
OptInfo
*
)
NIL
;
#if 0 /* fix xfunc */
...
...
src/backend/optimizer/util/indexnode.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.
7 1998/06/15 19:28:48
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.
8 1998/07/18 04:22:40
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -33,7 +33,7 @@ static List *find_secondary_index(Query *root, Oid relid);
*
*/
List
*
find_relation_indices
(
Query
*
root
,
Rel
*
rel
)
find_relation_indices
(
Query
*
root
,
Rel
OptInfo
*
rel
)
{
if
(
rel
->
indexed
)
return
(
find_secondary_index
(
root
,
lfirsti
(
rel
->
relids
)));
...
...
@@ -61,7 +61,7 @@ find_secondary_index(Query *root, Oid relid)
while
(
index_info
(
root
,
first
,
relid
,
&
indexinfo
))
{
Rel
*
indexnode
=
makeNode
(
Rel
);
Rel
OptInfo
*
indexnode
=
makeNode
(
RelOptInfo
);
indexnode
->
relids
=
lconsi
(
indexinfo
.
relid
,
NIL
);
indexnode
->
relam
=
indexinfo
.
relam
;
...
...
src/backend/optimizer/util/joininfo.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.
7 1998/06/15 19:28:48
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.
8 1998/07/18 04:22:40
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -62,7 +62,7 @@ joininfo_member(List *join_relids, List *joininfo_list)
*
*/
JInfo
*
find_joininfo_node
(
Rel
*
this_rel
,
List
*
join_relids
)
find_joininfo_node
(
Rel
OptInfo
*
this_rel
,
List
*
join_relids
)
{
JInfo
*
joininfo
=
joininfo_member
(
join_relids
,
this_rel
->
joininfo
);
...
...
src/backend/optimizer/util/keys.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.
6 1998/02/26 04:33:19
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/keys.c,v 1.
7 1998/07/18 04:22:41
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -54,7 +54,7 @@ static bool equal_indexkey_var(int index_key, Var *var);
*
*/
bool
match_indexkey_operand
(
int
indexkey
,
Var
*
operand
,
Rel
*
rel
)
match_indexkey_operand
(
int
indexkey
,
Var
*
operand
,
Rel
OptInfo
*
rel
)
{
if
(
IsA
(
operand
,
Var
)
&&
(
lfirsti
(
rel
->
relids
)
==
operand
->
varno
)
&&
...
...
src/backend/optimizer/util/pathnode.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.
8 1998/06/15 19:28:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.
9 1998/07/18 04:22:41
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -62,13 +62,13 @@ path_is_cheaper(Path *path1, Path *path2)
*
*/
Path
*
set_cheapest
(
Rel
*
parent_rel
,
List
*
pathlist
)
set_cheapest
(
Rel
OptInfo
*
parent_rel
,
List
*
pathlist
)
{
List
*
p
;
Path
*
cheapest_so_far
;
Assert
(
pathlist
!=
NIL
);
Assert
(
IsA
(
parent_rel
,
Rel
));
Assert
(
IsA
(
parent_rel
,
Rel
OptInfo
));
cheapest_so_far
=
(
Path
*
)
lfirst
(
pathlist
);
...
...
@@ -99,7 +99,7 @@ set_cheapest(Rel *parent_rel, List *pathlist)
*
*/
List
*
add_pathlist
(
Rel
*
parent_rel
,
List
*
unique_paths
,
List
*
new_paths
)
add_pathlist
(
Rel
OptInfo
*
parent_rel
,
List
*
unique_paths
,
List
*
new_paths
)
{
List
*
x
;
Path
*
new_path
;
...
...
@@ -200,7 +200,7 @@ better_path(Path *new_path, List *unique_paths, bool *noOther)
*
*/
Path
*
create_seqscan_path
(
Rel
*
rel
)
create_seqscan_path
(
Rel
OptInfo
*
rel
)
{
int
relid
=
0
;
...
...
@@ -251,8 +251,8 @@ create_seqscan_path(Rel *rel)
*/
IndexPath
*
create_index_path
(
Query
*
root
,
Rel
*
rel
,
Rel
*
index
,
Rel
OptInfo
*
rel
,
Rel
OptInfo
*
index
,
List
*
restriction_clauses
,
bool
is_join_scan
)
{
...
...
@@ -406,8 +406,8 @@ create_index_path(Query *root,
*
*/
JoinPath
*
create_nestloop_path
(
Rel
*
joinrel
,
Rel
*
outer_rel
,
create_nestloop_path
(
Rel
OptInfo
*
joinrel
,
Rel
OptInfo
*
outer_rel
,
Path
*
outer_path
,
Path
*
inner_path
,
List
*
keys
)
...
...
@@ -481,7 +481,7 @@ create_nestloop_path(Rel *joinrel,
*
*/
MergePath
*
create_mergesort_path
(
Rel
*
joinrel
,
create_mergesort_path
(
Rel
OptInfo
*
joinrel
,
int
outersize
,
int
innersize
,
int
outerwidth
,
...
...
@@ -547,7 +547,7 @@ create_mergesort_path(Rel *joinrel,
*
*/
HashPath
*
create_hashjoin_path
(
Rel
*
joinrel
,
create_hashjoin_path
(
Rel
OptInfo
*
joinrel
,
int
outersize
,
int
innersize
,
int
outerwidth
,
...
...
src/backend/optimizer/util/relnode.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.
5 1998/02/26 04:33:2
1 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.
6 1998/07/18 04:22:4
1 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -27,17 +27,17 @@
* necessary. This is for base relations.
*
*/
Rel
*
Rel
OptInfo
*
get_base_rel
(
Query
*
root
,
int
relid
)
{
List
*
relids
;
Rel
*
rel
;
Rel
OptInfo
*
rel
;
relids
=
lconsi
(
relid
,
NIL
);
rel
=
rel_member
(
relids
,
root
->
base_relation_list_
);
if
(
rel
==
NULL
)
{
rel
=
makeNode
(
Rel
);
rel
=
makeNode
(
Rel
OptInfo
);
rel
->
relids
=
relids
;
rel
->
indexed
=
false
;
rel
->
pages
=
0
;
...
...
@@ -100,7 +100,7 @@ get_base_rel(Query *root, int relid)
* creating a new one if necessary. This is for join relations.
*
*/
Rel
*
Rel
OptInfo
*
get_join_rel
(
Query
*
root
,
List
*
relid
)
{
return
rel_member
(
relid
,
root
->
join_relation_list_
);
...
...
@@ -114,7 +114,7 @@ get_join_rel(Query *root, List *relid)
* Returns the corresponding entry in 'rels' if it is there.
*
*/
Rel
*
Rel
OptInfo
*
rel_member
(
List
*
relid
,
List
*
rels
)
{
List
*
temp
=
NIL
;
...
...
@@ -124,9 +124,9 @@ rel_member(List *relid, List *rels)
{
foreach
(
temp
,
rels
)
{
temprelid
=
((
Rel
*
)
lfirst
(
temp
))
->
relids
;
temprelid
=
((
Rel
OptInfo
*
)
lfirst
(
temp
))
->
relids
;
if
(
same
(
temprelid
,
relid
))
return
((
Rel
*
)
(
lfirst
(
temp
)));
return
((
Rel
OptInfo
*
)
(
lfirst
(
temp
)));
}
}
return
(
NULL
);
...
...
src/backend/optimizer/util/tlist.c
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.1
3 1998/06/15 19:28:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.1
4 1998/07/18 04:22:41
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -93,7 +93,7 @@ matching_tlvar(Var *var, List *targetlist)
* CREATES: new var-node iff no matching var-node exists in targetlist
*/
void
add_tl_element
(
Rel
*
rel
,
Var
*
var
)
add_tl_element
(
Rel
OptInfo
*
rel
,
Var
*
var
)
{
Expr
*
oldvar
=
(
Expr
*
)
NULL
;
...
...
src/include/nodes/nodes.h
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: nodes.h,v 1.2
4 1998/02/13 03:45:23 vadim
Exp $
* $Id: nodes.h,v 1.2
5 1998/07/18 04:22:45 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -70,7 +70,7 @@ typedef enum NodeTag
* TAGS FOR INNER PLAN NODES (relation.h)
*---------------------
*/
T_Rel
=
200
,
T_Rel
OptInfo
=
200
,
T_Path
,
T_IndexPath
,
T_JoinPath
,
...
...
src/include/nodes/relation.h
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: relation.h,v 1.
7 1997/09/08 21:53:01
momjian Exp $
* $Id: relation.h,v 1.
8 1998/07/18 04:22:45
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -24,7 +24,7 @@
typedef
List
*
Relid
;
/*
* Rel
* Rel
OptInfo
* Per-base-relation information
*
* Parts of this data structure are specific to various scan and join
...
...
@@ -47,7 +47,7 @@ typedef List *Relid;
* leaves the tuples unordered)
* cheapestpath - least expensive Path (regardless of final order)
* pruneable - flag to let the planner know whether it can prune the plan
* space of this Rel or not. -- JMH, 11/11/92
* space of this Rel
OptInfo
or not. -- JMH, 11/11/92
*
* * If the relation is a (secondary) index it will have the following
* three fields:
...
...
@@ -71,7 +71,7 @@ typedef List *Relid;
* is always 0. 2/95 - ay
*/
typedef
struct
Rel
typedef
struct
Rel
OptInfo
{
NodeTag
type
;
...
...
@@ -106,7 +106,7 @@ typedef struct Rel
List
*
joininfo
;
/* join clauses */
List
*
innerjoin
;
List
*
superrels
;
}
Rel
;
}
Rel
OptInfo
;
extern
Var
*
get_expr
(
TargetEntry
*
foo
);
...
...
@@ -139,7 +139,7 @@ typedef struct Path
{
NodeTag
type
;
Rel
*
parent
;
Rel
OptInfo
*
parent
;
Cost
path_cost
;
NodeTag
pathtype
;
...
...
src/include/optimizer/cost.h
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: cost.h,v 1.
8 1998/02/26 04:42:14
momjian Exp $
* $Id: cost.h,v 1.
9 1998/07/18 04:22:46
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -47,8 +47,8 @@ extern Cost
cost_hashjoin
(
Cost
outercost
,
Cost
innercost
,
List
*
outerkeys
,
List
*
innerkeys
,
int
outersize
,
int
innersize
,
int
outerwidth
,
int
innerwidth
);
extern
int
compute_rel_size
(
Rel
*
rel
);
extern
int
compute_rel_width
(
Rel
*
rel
);
extern
int
compute_rel_size
(
Rel
OptInfo
*
rel
);
extern
int
compute_rel_width
(
Rel
OptInfo
*
rel
);
extern
int
compute_joinrel_size
(
JoinPath
*
joinpath
);
extern
int
page_size
(
int
tuples
,
int
width
);
...
...
src/include/optimizer/geqo.h
View file @
584f9438
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo.h,v 1.
7 1997/11/26 01:13:23
momjian Exp $
* $Id: geqo.h,v 1.
8 1998/07/18 04:22:50
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -70,13 +70,13 @@ double SelectionBias;
/* ^^^ */
/* geqo prototypes */
extern
Rel
*
geqo
(
Query
*
root
);
extern
Rel
OptInfo
*
geqo
(
Query
*
root
);
extern
void
geqo_params
(
int
string_length
);
extern
Cost
geqo_eval
(
Query
*
root
,
Gene
*
tour
,
int
num_gene
);
double
geqo_log
(
double
x
,
double
b
);
extern
Rel
*
gimme_tree
(
Query
*
root
,
Gene
*
tour
,
int
rel_count
,
int
num_gene
,
Rel
*
outer_rel
);
extern
Rel
OptInfo
*
gimme_tree
(
Query
*
root
,
Gene
*
tour
,
int
rel_count
,
int
num_gene
,
RelOptInfo
*
outer_rel
);
#endif
/* GEQO_H */
src/include/optimizer/geqo_misc.h
View file @
584f9438
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_misc.h,v 1.
5 1997/11/26 01:13:28
momjian Exp $
* $Id: geqo_misc.h,v 1.
6 1998/07/18 04:22:50
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -31,7 +31,7 @@ extern void print_pool(FILE *fp, Pool *pool, int start, int stop);
extern
void
print_gen
(
FILE
*
fp
,
Pool
*
pool
,
int
generation
);
extern
void
print_edge_table
(
FILE
*
fp
,
Edge
*
edge_table
,
int
num_gene
);
extern
void
geqo_print_rel
(
Query
*
root
,
Rel
*
rel
);
extern
void
geqo_print_rel
(
Query
*
root
,
Rel
OptInfo
*
rel
);
extern
void
geqo_print_path
(
Query
*
root
,
Path
*
path
,
int
indent
);
extern
void
geqo_print_joinclauses
(
Query
*
root
,
List
*
clauses
);
...
...
src/include/optimizer/geqo_paths.h
View file @
584f9438
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo_paths.h,v 1.
4 1997/09/08 21:53:14
momjian Exp $
* $Id: geqo_paths.h,v 1.
5 1998/07/18 04:22:50
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -23,6 +23,6 @@
extern
List
*
geqo_prune_rels
(
List
*
rel_list
);
extern
void
geqo_rel_paths
(
Rel
*
rel
);
extern
void
geqo_rel_paths
(
Rel
OptInfo
*
rel
);
#endif
/* GEQO_PATHS_H */
src/include/optimizer/joininfo.h
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: joininfo.h,v 1.
5 1997/11/26 01:13:39
momjian Exp $
* $Id: joininfo.h,v 1.
6 1998/07/18 04:22:51
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -18,7 +18,7 @@
#include "nodes/primnodes.h"
extern
JInfo
*
joininfo_member
(
List
*
join_relids
,
List
*
joininfo_list
);
extern
JInfo
*
find_joininfo_node
(
Rel
*
this_rel
,
List
*
join_relids
);
extern
JInfo
*
find_joininfo_node
(
Rel
OptInfo
*
this_rel
,
List
*
join_relids
);
extern
Var
*
other_join_clause_var
(
Var
*
var
,
Expr
*
clause
);
#endif
/* JOININFO_H */
src/include/optimizer/keys.h
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: keys.h,v 1.
6 1997/11/26 01:13:4
1 momjian Exp $
* $Id: keys.h,v 1.
7 1998/07/18 04:22:5
1 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -16,7 +16,7 @@
#include "nodes/nodes.h"
#include "nodes/relation.h"
extern
bool
match_indexkey_operand
(
int
indexkey
,
Var
*
operand
,
Rel
*
rel
);
extern
bool
match_indexkey_operand
(
int
indexkey
,
Var
*
operand
,
Rel
OptInfo
*
rel
);
extern
Var
*
extract_subkey
(
JoinKey
*
jk
,
int
which_subkey
);
extern
bool
samekeys
(
List
*
keys1
,
List
*
keys2
);
extern
List
*
collect_index_pathkeys
(
int
*
index_keys
,
List
*
tlist
);
...
...
src/include/optimizer/pathnode.h
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pathnode.h,v 1.
7 1998/02/26 04:42:16
momjian Exp $
* $Id: pathnode.h,v 1.
8 1998/07/18 04:22:51
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -21,25 +21,25 @@
* prototypes for pathnode.c
*/
extern
bool
path_is_cheaper
(
Path
*
path1
,
Path
*
path2
);
extern
Path
*
set_cheapest
(
Rel
*
parent_rel
,
List
*
pathlist
);
extern
Path
*
set_cheapest
(
Rel
OptInfo
*
parent_rel
,
List
*
pathlist
);
extern
List
*
add_pathlist
(
Rel
*
parent_rel
,
List
*
unique_paths
,
add_pathlist
(
Rel
OptInfo
*
parent_rel
,
List
*
unique_paths
,
List
*
new_paths
);
extern
Path
*
create_seqscan_path
(
Rel
*
rel
);
extern
Path
*
create_seqscan_path
(
Rel
OptInfo
*
rel
);
extern
IndexPath
*
create_index_path
(
Query
*
root
,
Rel
*
rel
,
Rel
*
index
,
create_index_path
(
Query
*
root
,
Rel
OptInfo
*
rel
,
RelOptInfo
*
index
,
List
*
restriction_clauses
,
bool
is_join_scan
);
extern
JoinPath
*
create_nestloop_path
(
Rel
*
joinrel
,
Rel
*
outer_rel
,
create_nestloop_path
(
Rel
OptInfo
*
joinrel
,
RelOptInfo
*
outer_rel
,
Path
*
outer_path
,
Path
*
inner_path
,
List
*
keys
);
extern
MergePath
*
create_mergesort_path
(
Rel
*
joinrel
,
int
outersize
,
create_mergesort_path
(
Rel
OptInfo
*
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
);
extern
HashPath
*
create_hashjoin_path
(
Rel
*
joinrel
,
int
outersize
,
create_hashjoin_path
(
Rel
OptInfo
*
joinrel
,
int
outersize
,
int
innersize
,
int
outerwidth
,
int
innerwidth
,
Path
*
outer_path
,
Path
*
inner_path
,
List
*
keys
,
Oid
operator
,
List
*
hashclauses
,
List
*
outerkeys
,
List
*
innerkeys
);
...
...
@@ -47,13 +47,13 @@ create_hashjoin_path(Rel *joinrel, int outersize,
/*
* prototypes for rel.c
*/
extern
Rel
*
rel_member
(
List
*
relid
,
List
*
rels
);
extern
Rel
*
get_base_rel
(
Query
*
root
,
int
relid
);
extern
Rel
*
get_join_rel
(
Query
*
root
,
List
*
relid
);
extern
Rel
OptInfo
*
rel_member
(
List
*
relid
,
List
*
rels
);
extern
Rel
OptInfo
*
get_base_rel
(
Query
*
root
,
int
relid
);
extern
Rel
OptInfo
*
get_join_rel
(
Query
*
root
,
List
*
relid
);
/*
* prototypes for indexnode.h
*/
extern
List
*
find_relation_indices
(
Query
*
root
,
Rel
*
rel
);
extern
List
*
find_relation_indices
(
Query
*
root
,
Rel
OptInfo
*
rel
);
#endif
/* PATHNODE_H */
src/include/optimizer/paths.h
View file @
584f9438
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: paths.h,v 1.
8 1998/02/26 04:42:17
momjian Exp $
* $Id: paths.h,v 1.
9 1998/07/18 04:22:51
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
,
Rel
*
rel
,
List
*
indices
,
find_index_paths
(
Query
*
root
,
Rel
OptInfo
*
rel
,
List
*
indices
,
List
*
clauseinfo_list
,
List
*
joininfo_list
);
...
...
@@ -42,7 +42,7 @@ extern void find_all_join_paths(Query *root, List *joinrels);
/*
* orindxpath.h
*/
extern
List
*
create_or_index_paths
(
Query
*
root
,
Rel
*
rel
,
List
*
clauses
);
extern
List
*
create_or_index_paths
(
Query
*
root
,
Rel
OptInfo
*
rel
,
List
*
clauses
);
/*
* hashutils.h
...
...
@@ -94,7 +94,7 @@ extern List *final_join_rels(List *join_rel_list);
*/
extern
void
prune_joinrels
(
List
*
rel_list
);
extern
void
prune_rel_paths
(
List
*
rel_list
);
extern
Path
*
prune_rel_path
(
Rel
*
rel
,
Path
*
unorderedpath
);
extern
Path
*
prune_rel_path
(
Rel
OptInfo
*
rel
,
Path
*
unorderedpath
);
extern
List
*
merge_joinrels
(
List
*
rel_list1
,
List
*
rel_list2
);
extern
List
*
prune_oldrels
(
List
*
old_rels
);
...
...
src/include/optimizer/tlist.h
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: tlist.h,v 1.
8 1998/02/26 04:42:31
momjian Exp $
* $Id: tlist.h,v 1.
9 1998/07/18 04:22:52
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -20,7 +20,7 @@
extern
int
exec_tlist_length
(
List
*
targelist
);
extern
TargetEntry
*
tlistentry_member
(
Var
*
var
,
List
*
targetlist
);
extern
Expr
*
matching_tlvar
(
Var
*
var
,
List
*
targetlist
);
extern
void
add_tl_element
(
Rel
*
rel
,
Var
*
var
);
extern
void
add_tl_element
(
Rel
OptInfo
*
rel
,
Var
*
var
);
extern
TargetEntry
*
create_tl_element
(
Var
*
var
,
int
resdomno
);
extern
List
*
get_actual_tlist
(
List
*
tlist
);
extern
Resdom
*
tlist_member
(
Var
*
var
,
List
*
tlist
);
...
...
src/include/optimizer/xfunc.h
View file @
584f9438
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: xfunc.h,v 1.
7 1998/02/26 04:42:33
momjian Exp $
* $Id: xfunc.h,v 1.
8 1998/07/18 04:22:52
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -49,7 +49,7 @@ extern int XfuncMode; /* defined in tcop/postgres.c */
#define is_join(pathnode) (length(get_relids(get_parent(pathnode))) > 1 ? 1 : 0)
/* function prototypes from planner/path/xfunc.c */
extern
void
xfunc_trypullup
(
Rel
*
rel
);
extern
void
xfunc_trypullup
(
Rel
OptInfo
*
rel
);
extern
int
xfunc_shouldpull
(
Path
*
childpath
,
JoinPath
*
parentpath
,
int
whichchild
,
CInfo
*
maxcinfopt
);
...
...
@@ -71,7 +71,7 @@ extern List *xfunc_primary_join(JoinPath *pathnode);
extern
Cost
xfunc_get_path_cost
(
Path
*
pathnode
);
extern
Cost
xfunc_total_path_cost
(
JoinPath
*
pathnode
);
extern
Cost
xfunc_expense_per_tuple
(
JoinPath
*
joinnode
,
int
whichchild
);
extern
void
xfunc_fixvars
(
Expr
*
clause
,
Rel
*
rel
,
int
varno
);
extern
void
xfunc_fixvars
(
Expr
*
clause
,
Rel
OptInfo
*
rel
,
int
varno
);
extern
int
xfunc_cinfo_compare
(
void
*
arg1
,
void
*
arg2
);
extern
int
xfunc_clause_compare
(
void
*
arg1
,
void
*
arg2
);
extern
void
xfunc_disjunct_sort
(
List
*
clause_list
);
...
...
@@ -80,7 +80,7 @@ extern int xfunc_func_width(RegProcedure funcid, List *args);
extern
int
xfunc_tuple_width
(
Relation
rd
);
extern
int
xfunc_num_join_clauses
(
JoinPath
*
path
);
extern
List
*
xfunc_LispRemove
(
List
*
foo
,
List
*
bar
);
extern
bool
xfunc_copyrel
(
Rel
*
from
,
Rel
**
to
);
extern
bool
xfunc_copyrel
(
Rel
OptInfo
*
from
,
RelOptInfo
**
to
);
/*
* function prototypes for path/predmig.c
...
...
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