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
c5449d53
Commit
c5449d53
authored
Feb 15, 1999
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
otherrels is now unjoined_rels
parent
82682ff3
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
78 additions
and
84 deletions
+78
-84
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+2
-2
src/backend/nodes/equalfuncs.c
src/backend/nodes/equalfuncs.c
+2
-2
src/backend/nodes/freefuncs.c
src/backend/nodes/freefuncs.c
+2
-2
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+3
-3
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+3
-3
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/allpaths.c
+19
-26
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/indxpath.c
+2
-2
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/joinrels.c
+24
-24
src/backend/optimizer/path/prune.c
src/backend/optimizer/path/prune.c
+10
-10
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/initsplan.c
+6
-5
src/backend/optimizer/util/joininfo.c
src/backend/optimizer/util/joininfo.c
+3
-3
src/include/nodes/relation.h
src/include/nodes/relation.h
+2
-2
No files found.
src/backend/nodes/copyfuncs.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.7
1 1999/02/15 03:21:58
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.7
2 1999/02/15 05:21:01
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1428,7 +1428,7 @@ _copyJoinInfo(JoinInfo *from)
* copy remainder of node
* ----------------
*/
newnode
->
otherrels
=
listCopy
(
from
->
other
rels
);
newnode
->
unjoined_rels
=
listCopy
(
from
->
unjoined_
rels
);
Node_Copy
(
from
,
newnode
,
jinfo_restrictinfo
);
newnode
->
mergejoinable
=
from
->
mergejoinable
;
...
...
src/backend/nodes/equalfuncs.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.3
3 1999/02/15 03:21:59
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v 1.3
4 1999/02/15 05:21:02
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -526,7 +526,7 @@ _equalJoinInfo(JoinInfo *a, JoinInfo *b)
{
Assert
(
IsA
(
a
,
JoinInfo
));
Assert
(
IsA
(
b
,
JoinInfo
));
if
(
!
equal
(
a
->
otherrels
,
b
->
other
rels
))
if
(
!
equal
(
a
->
unjoined_rels
,
b
->
unjoined_
rels
))
return
false
;
if
(
!
equal
(
a
->
jinfo_restrictinfo
,
b
->
jinfo_restrictinfo
))
return
false
;
...
...
src/backend/nodes/freefuncs.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.1
1 1999/02/15 03:21:59
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.1
2 1999/02/15 05:21:02
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1024,7 +1024,7 @@ _freeJoinInfo(JoinInfo *node)
* free remainder of node
* ----------------
*/
freeList
(
node
->
other
rels
);
freeList
(
node
->
unjoined_
rels
);
freeObject
(
node
->
jinfo_restrictinfo
);
pfree
(
node
);
...
...
src/backend/nodes/outfuncs.c
View file @
c5449d53
...
...
@@ -5,7 +5,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: outfuncs.c,v 1.7
3 1999/02/15 03:21:59
momjian Exp $
* $Id: outfuncs.c,v 1.7
4 1999/02/15 05:21:02
momjian Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
...
...
@@ -1198,8 +1198,8 @@ _outHashInfo(StringInfo str, HashInfo *node)
static
void
_outJoinInfo
(
StringInfo
str
,
JoinInfo
*
node
)
{
appendStringInfo
(
str
,
" JINFO :
other
rels "
);
_outIntList
(
str
,
node
->
other
rels
);
appendStringInfo
(
str
,
" JINFO :
unjoined_
rels "
);
_outIntList
(
str
,
node
->
unjoined_
rels
);
appendStringInfo
(
str
,
" :jinfo_restrictinfo "
);
_outNode
(
str
,
node
->
jinfo_restrictinfo
);
...
...
src/backend/nodes/readfuncs.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.5
7 1999/02/13 23:16:02
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.5
8 1999/02/15 05:21:03
momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
...
...
@@ -1982,8 +1982,8 @@ _readJoinInfo()
local_node
=
makeNode
(
JoinInfo
);
token
=
lsptok
(
NULL
,
&
length
);
/* get :
other
rels */
local_node
->
other
rels
=
toIntList
(
nodeRead
(
true
));
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :
unjoined_
rels */
local_node
->
unjoined_
rels
=
toIntList
(
nodeRead
(
true
));
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* get :jinfo_restrictinfo */
local_node
->
jinfo_restrictinfo
=
nodeRead
(
true
);
/* now read it */
...
...
src/backend/optimizer/path/allpaths.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.3
6 1999/02/15 03:59:27
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.3
7 1999/02/15 05:21:03
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -43,8 +43,9 @@ bool _use_geqo_ = false;
int32
_use_geqo_rels_
=
GEQO_RELS
;
static
void
find_base_rel_paths
(
Query
*
root
,
List
*
rels
);
static
RelOptInfo
*
make_one_rel_by_joins
(
Query
*
root
,
List
*
outer_rels
,
int
levels_needed
);
static
void
set_base_rel_pathlist
(
Query
*
root
,
List
*
rels
);
static
RelOptInfo
*
make_one_rel_by_joins
(
Query
*
root
,
List
*
rels
,
int
levels_needed
);
#ifdef OPTIMIZER_DEBUG
static
void
debug_print_rel
(
Query
*
root
,
RelOptInfo
*
rel
);
...
...
@@ -71,7 +72,7 @@ make_one_rel(Query *root, List *rels)
if
(
levels_needed
<=
0
)
return
NULL
;
find_base_rel_paths
(
root
,
rels
);
set_base_rel_pathlist
(
root
,
rels
);
if
(
levels_needed
<=
1
)
{
...
...
@@ -83,7 +84,7 @@ make_one_rel(Query *root, List *rels)
else
{
/*
*
t
his means that joins or sorts are required. set selectivities
*
T
his means that joins or sorts are required. set selectivities
* of clauses that have not been set by an index.
*/
set_rest_relselec
(
root
,
rels
);
...
...
@@ -93,7 +94,7 @@ make_one_rel(Query *root, List *rels)
}
/*
*
find_base_rel_paths
*
set_base_rel_pathlist
* Finds all paths available for scanning each relation entry in
* 'rels'. Sequential scan and any available indices are considered
* if possible(indices are not considered for lower nesting levels).
...
...
@@ -102,7 +103,7 @@ make_one_rel(Query *root, List *rels)
* MODIFIES: rels
*/
static
void
find_base_rel_paths
(
Query
*
root
,
List
*
rels
)
set_base_rel_pathlist
(
Query
*
root
,
List
*
rels
)
{
List
*
temp
;
...
...
@@ -150,7 +151,7 @@ find_base_rel_paths(Query *root, List *rels)
* Find all possible joinpaths(bushy trees) for a query by systematically
* finding ways to join relations(both original and derived) together.
*
* '
outer_
rels' is the current list of relations for which join paths
* 'rels' is the current list of relations for which join paths
* are to be found, i.e., the current list of relations that
* have already been derived.
* 'levels_needed' is the number of iterations needed
...
...
@@ -159,7 +160,7 @@ find_base_rel_paths(Query *root, List *rels)
* the result of joining all the original relations together.
*/
static
RelOptInfo
*
make_one_rel_by_joins
(
Query
*
root
,
List
*
outer_
rels
,
int
levels_needed
)
make_one_rel_by_joins
(
Query
*
root
,
List
*
rels
,
int
levels_needed
)
{
List
*
x
;
List
*
joined_rels
=
NIL
;
...
...
@@ -184,7 +185,7 @@ make_one_rel_by_joins(Query *root, List *outer_rels, int levels_needed)
* modify 'joined_rels' accordingly, then eliminate redundant join
* relations.
*/
joined_rels
=
make_rels_by_joins
(
root
,
outer_
rels
);
joined_rels
=
make_rels_by_joins
(
root
,
rels
);
update_rels_pathlist_for_joins
(
root
,
joined_rels
);
...
...
@@ -211,7 +212,7 @@ make_one_rel_by_joins(Query *root, List *outer_rels, int levels_needed)
* involves the join relation to the joininfo list of the
* other relation
*/
add_rel_to_rel_joininfos
(
root
,
joined_rels
,
outer_
rels
);
add_rel_to_rel_joininfos
(
root
,
joined_rels
,
rels
);
}
#endif
...
...
@@ -236,33 +237,25 @@ make_one_rel_by_joins(Query *root, List *outer_rels, int levels_needed)
* prune rels that have been completely incorporated into new
* join rels
*/
outer_rels
=
del_rels_all_bushy_inactive
(
outer_
rels
);
rels
=
del_rels_all_bushy_inactive
(
rels
);
/*
* merge join rels if then contain the same list of base rels
*/
outer_rels
=
merge_rels_with_same_relids
(
joined_rels
,
outer_rels
);
root
->
join_rel_list
=
outer_rels
;
joined_rels
=
merge_rels_with_same_relids
(
joined_rels
,
rels
);
}
else
#endif
root
->
join_rel_list
=
joined_rels
;
#ifdef NOT_USED
if
(
!
BushyPlanFlag
)
#endif
outer_rels
=
joined_rels
;
root
->
join_rel_list
=
rels
=
joined_rels
;
}
Assert
(
length
(
joined_
rels
)
==
1
);
Assert
(
BushyPlanFlag
||
length
(
rels
)
==
1
);
#ifdef NOT_USED
if
(
BushyPlanFlag
)
return
final_join_rels
(
outer_
rels
);
return
get_cheapest_complete_rel
(
rels
);
else
#endif
return
lfirst
(
joined_
rels
);
return
lfirst
(
rels
);
}
/*****************************************************************************
...
...
src/backend/optimizer/path/indxpath.c
View file @
c5449d53
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.4
7 1999/02/15 03:22:05
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.4
8 1999/02/15 05:21:04
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1208,7 +1208,7 @@ indexable_joinclauses(RelOptInfo *rel, RelOptInfo *index,
{
List
*
clauses
=
lfirst
(
clausegroups
);
((
RestrictInfo
*
)
lfirst
(
clauses
))
->
restrictinfojoinid
=
joininfo
->
other
rels
;
((
RestrictInfo
*
)
lfirst
(
clauses
))
->
restrictinfojoinid
=
joininfo
->
unjoined_
rels
;
}
cg_list
=
nconc
(
cg_list
,
clausegroups
);
}
...
...
src/backend/optimizer/path/joinrels.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.2
4 1999/02/15 03:59:27
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.2
5 1999/02/15 05:21:05
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -113,17 +113,17 @@ make_rels_by_clause_joins(Query *root, RelOptInfo *outer_rel,
if
(
!
joininfo
->
bushy_inactive
)
{
List
*
other_rels
=
joininfo
->
other
rels
;
List
*
unjoined_rels
=
joininfo
->
unjoined_
rels
;
if
(
other
_rels
!=
NIL
)
if
(
unjoined
_rels
!=
NIL
)
{
if
(
length
(
other
_rels
)
==
1
&&
if
(
length
(
unjoined
_rels
)
==
1
&&
(
only_relids
==
NIL
||
/* geqo only wants certain relids to make new rels */
same
(
joininfo
->
other
rels
,
only_relids
)))
same
(
joininfo
->
unjoined_
rels
,
only_relids
)))
{
rel
=
make_join_rel
(
outer_rel
,
get_base_rel
(
root
,
lfirsti
(
other
_rels
)),
get_base_rel
(
root
,
lfirsti
(
unjoined
_rels
)),
joininfo
);
/* how about right-sided plan ? */
if
(
_use_right_sided_plans_
&&
...
...
@@ -132,7 +132,7 @@ make_rels_by_clause_joins(Query *root, RelOptInfo *outer_rel,
if
(
rel
!=
NULL
)
join_list
=
lappend
(
join_list
,
rel
);
rel
=
make_join_rel
(
get_base_rel
(
root
,
lfirsti
(
other
_rels
)),
lfirsti
(
unjoined
_rels
)),
outer_rel
,
joininfo
);
}
...
...
@@ -141,7 +141,7 @@ make_rels_by_clause_joins(Query *root, RelOptInfo *outer_rel,
else
if
(
BushyPlanFlag
)
{
rel
=
make_join_rel
(
outer_rel
,
get_join_rel
(
root
,
other
_rels
),
get_join_rel
(
root
,
unjoined
_rels
),
joininfo
);
}
#endif
...
...
@@ -328,7 +328,7 @@ static List *
new_joininfo_list
(
List
*
joininfo_list
,
List
*
join_relids
)
{
List
*
current_joininfo_list
=
NIL
;
List
*
new_
other
rels
=
NIL
;
List
*
new_
unjoined_
rels
=
NIL
;
JoinInfo
*
other_joininfo
=
(
JoinInfo
*
)
NULL
;
List
*
xjoininfo
=
NIL
;
...
...
@@ -337,16 +337,16 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
List
*
or
;
JoinInfo
*
joininfo
=
(
JoinInfo
*
)
lfirst
(
xjoininfo
);
new_
otherrels
=
joininfo
->
other
rels
;
foreach
(
or
,
new_
other
rels
)
new_
unjoined_rels
=
joininfo
->
unjoined_
rels
;
foreach
(
or
,
new_
unjoined_
rels
)
{
if
(
intMember
(
lfirsti
(
or
),
join_relids
))
new_
otherrels
=
lremove
((
void
*
)
lfirst
(
or
),
new_other
rels
);
new_
unjoined_rels
=
lremove
((
void
*
)
lfirst
(
or
),
new_unjoined_
rels
);
}
joininfo
->
otherrels
=
new_other
rels
;
if
(
new_
other
rels
!=
NIL
)
joininfo
->
unjoined_rels
=
new_unjoined_
rels
;
if
(
new_
unjoined_
rels
!=
NIL
)
{
other_joininfo
=
joininfo_member
(
new_
other
rels
,
other_joininfo
=
joininfo_member
(
new_
unjoined_
rels
,
current_joininfo_list
);
if
(
other_joininfo
)
{
...
...
@@ -357,7 +357,7 @@ new_joininfo_list(List *joininfo_list, List *join_relids)
{
other_joininfo
=
makeNode
(
JoinInfo
);
other_joininfo
->
otherrels
=
joininfo
->
other
rels
;
other_joininfo
->
unjoined_rels
=
joininfo
->
unjoined_
rels
;
other_joininfo
->
jinfo_restrictinfo
=
joininfo
->
jinfo_restrictinfo
;
other_joininfo
->
mergejoinable
=
joininfo
->
mergejoinable
;
other_joininfo
->
hashjoinable
=
joininfo
->
hashjoinable
;
...
...
@@ -410,12 +410,12 @@ add_rel_to_rel_joininfos(Query *root, List *joinrels, List *outerrels)
foreach
(
xjoininfo
,
joinrel
->
joininfo
)
{
JoinInfo
*
joininfo
=
(
JoinInfo
*
)
lfirst
(
xjoininfo
);
List
*
other_rels
=
joininfo
->
other
rels
;
List
*
unjoined_rels
=
joininfo
->
unjoined_
rels
;
List
*
restrict_info
=
joininfo
->
jinfo_restrictinfo
;
bool
mergejoinable
=
joininfo
->
mergejoinable
;
bool
hashjoinable
=
joininfo
->
hashjoinable
;
foreach
(
xrelid
,
other
_rels
)
foreach
(
xrelid
,
unjoined
_rels
)
{
Relid
relid
=
(
Relid
)
lfirst
(
xrelid
);
RelOptInfo
*
rel
=
get_join_rel
(
root
,
relid
);
...
...
@@ -423,7 +423,7 @@ add_rel_to_rel_joininfos(Query *root, List *joinrels, List *outerrels)
List
*
xsuper_rel
=
NIL
;
JoinInfo
*
new_joininfo
=
makeNode
(
JoinInfo
);
new_joininfo
->
other
rels
=
joinrel
->
relids
;
new_joininfo
->
unjoined_
rels
=
joinrel
->
relids
;
new_joininfo
->
jinfo_restrictinfo
=
restrict_info
;
new_joininfo
->
mergejoinable
=
mergejoinable
;
new_joininfo
->
hashjoinable
=
hashjoinable
;
...
...
@@ -449,7 +449,7 @@ add_rel_to_rel_joininfos(Query *root, List *joinrels, List *outerrels)
{
JoinInfo
*
new_joininfo
=
makeNode
(
JoinInfo
);
new_joininfo
->
other
rels
=
new_relids
;
new_joininfo
->
unjoined_
rels
=
new_relids
;
new_joininfo
->
jinfo_restrictinfo
=
restrict_info
;
new_joininfo
->
mergejoinable
=
mergejoinable
;
new_joininfo
->
hashjoinable
=
hashjoinable
;
...
...
@@ -473,7 +473,7 @@ add_rel_to_rel_joininfos(Query *root, List *joinrels, List *outerrels)
#ifdef NOT_USED
/*
*
final_join_rels
*
get_cheapest_complete_rel
* Find the join relation that includes all the original
* relations, i.e. the final join result.
*
...
...
@@ -482,14 +482,14 @@ add_rel_to_rel_joininfos(Query *root, List *joinrels, List *outerrels)
* Returns the list of final join relations.
*/
RelOptInfo
*
final_join_rels
(
List
*
join_rel_list
)
get_cheapest_complete_rel
(
List
*
join_rel_list
)
{
List
*
xrel
=
NIL
;
RelOptInfo
*
final_rel
=
NULL
;
/*
* find the relations that has no further joins, i.e., its joininfos
* all have
other
rels nil.
* all have
unjoined_
rels nil.
*/
foreach
(
xrel
,
join_rel_list
)
{
...
...
@@ -501,7 +501,7 @@ final_join_rels(List *join_rel_list)
{
JoinInfo
*
joininfo
=
(
JoinInfo
*
)
lfirst
(
xjoininfo
);
if
(
joininfo
->
other
rels
!=
NIL
)
if
(
joininfo
->
unjoined_
rels
!=
NIL
)
{
final
=
false
;
break
;
...
...
src/backend/optimizer/path/prune.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.3
4 1999/02/15 03:59:27
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.3
5 1999/02/15 05:21:05
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -24,7 +24,7 @@
#include "utils/elog.h"
static
List
*
merge_rel_with_same_relids
(
RelOptInfo
*
rel
,
List
*
other
_rels
);
static
List
*
merge_rel_with_same_relids
(
RelOptInfo
*
rel
,
List
*
unjoined
_rels
);
/*
* merge_rels_with_same_relids
...
...
@@ -49,7 +49,7 @@ merge_rels_with_same_relids(List *rel_list)
/*
* merge_rel_with_same_relids
* Prunes those relations from '
other
_rels' that are redundant with
* Prunes those relations from '
unjoined
_rels' that are redundant with
* 'rel'. A relation is redundant if it is built up of the same
* relations as 'rel'. Paths for the redundant relation are merged into
* the pathlist of 'rel'.
...
...
@@ -59,25 +59,25 @@ merge_rels_with_same_relids(List *rel_list)
*
*/
static
List
*
merge_rel_with_same_relids
(
RelOptInfo
*
rel
,
List
*
other
_rels
)
merge_rel_with_same_relids
(
RelOptInfo
*
rel
,
List
*
unjoined
_rels
)
{
List
*
i
=
NIL
;
List
*
result
=
NIL
;
foreach
(
i
,
other
_rels
)
foreach
(
i
,
unjoined
_rels
)
{
RelOptInfo
*
other
_rel
=
(
RelOptInfo
*
)
lfirst
(
i
);
RelOptInfo
*
unjoined
_rel
=
(
RelOptInfo
*
)
lfirst
(
i
);
if
(
same
(
rel
->
relids
,
other
_rel
->
relids
))
if
(
same
(
rel
->
relids
,
unjoined
_rel
->
relids
))
/*
* This are on the same relations,
* so get the best of their pathlists.
*/
rel
->
pathlist
=
add_pathlist
(
rel
,
rel
->
pathlist
,
other
_rel
->
pathlist
);
unjoined
_rel
->
pathlist
);
else
result
=
lappend
(
result
,
other
_rel
);
result
=
lappend
(
result
,
unjoined
_rel
);
}
return
result
;
}
...
...
src/backend/optimizer/plan/initsplan.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.2
6 1999/02/15 03:22:11
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.2
7 1999/02/15 05:21:06
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -246,18 +246,19 @@ add_join_info_to_rels(Query *root, RestrictInfo *restrictinfo, List *join_relids
foreach
(
join_relid
,
join_relids
)
{
JoinInfo
*
joininfo
;
List
*
other
_rels
=
NIL
;
List
*
unjoined
_rels
=
NIL
;
List
*
rel
;
foreach
(
rel
,
join_relids
)
{
if
(
lfirsti
(
rel
)
!=
lfirsti
(
join_relid
))
other_rels
=
lappendi
(
other
_rels
,
lfirsti
(
rel
));
unjoined_rels
=
lappendi
(
unjoined
_rels
,
lfirsti
(
rel
));
}
joininfo
=
find_joininfo_node
(
get_base_rel
(
root
,
lfirsti
(
join_relid
)),
other_rels
);
joininfo
->
jinfo_restrictinfo
=
lcons
(
copyObject
((
void
*
)
restrictinfo
),
joininfo
->
jinfo_restrictinfo
);
unjoined_rels
);
joininfo
->
jinfo_restrictinfo
=
lcons
(
copyObject
((
void
*
)
restrictinfo
),
joininfo
->
jinfo_restrictinfo
);
}
}
...
...
src/backend/optimizer/util/joininfo.c
View file @
c5449d53
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.1
6 1999/02/15 03:22:16
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/joininfo.c,v 1.1
7 1999/02/15 05:21:11
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -44,7 +44,7 @@ joininfo_member(List *join_relids, List *joininfo_list)
foreach
(
i
,
joininfo_list
)
{
other_rels
=
lfirst
(
i
);
if
(
same
(
join_relids
,
((
JoinInfo
*
)
other_rels
)
->
other
rels
))
if
(
same
(
join_relids
,
((
JoinInfo
*
)
other_rels
)
->
unjoined_
rels
))
return
(
JoinInfo
*
)
other_rels
;
}
return
(
JoinInfo
*
)
NULL
;
...
...
@@ -70,7 +70,7 @@ find_joininfo_node(RelOptInfo *this_rel, List *join_relids)
if
(
joininfo
==
NULL
)
{
joininfo
=
makeNode
(
JoinInfo
);
joininfo
->
other
rels
=
join_relids
;
joininfo
->
unjoined_
rels
=
join_relids
;
joininfo
->
jinfo_restrictinfo
=
NIL
;
joininfo
->
mergejoinable
=
false
;
joininfo
->
hashjoinable
=
false
;
...
...
src/include/nodes/relation.h
View file @
c5449d53
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: relation.h,v 1.2
4 1999/02/15 03:22:23
momjian Exp $
* $Id: relation.h,v 1.2
5 1999/02/15 05:21:12
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -246,7 +246,7 @@ typedef struct MergeInfo
typedef
struct
JoinInfo
{
NodeTag
type
;
List
*
other
rels
;
List
*
unjoined_
rels
;
List
*
jinfo_restrictinfo
;
bool
mergejoinable
;
bool
hashjoinable
;
...
...
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