Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
3fdb9bb9
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3fdb9bb9
编写于
2月 12, 1999
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix optimizer and make faster.
上级
55d04650
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
60 addition
and
145 deletion
+60
-145
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+1
-2
src/backend/nodes/freefuncs.c
src/backend/nodes/freefuncs.c
+1
-2
src/backend/nodes/outfuncs.c
src/backend/nodes/outfuncs.c
+2
-3
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+1
-7
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/geqo/geqo_eval.c
+2
-4
src/backend/optimizer/geqo/geqo_paths.c
src/backend/optimizer/geqo/geqo_paths.c
+6
-52
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/allpaths.c
+3
-3
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/joinrels.c
+1
-2
src/backend/optimizer/path/prune.c
src/backend/optimizer/path/prune.c
+7
-48
src/backend/optimizer/util/indexnode.c
src/backend/optimizer/util/indexnode.c
+1
-2
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/pathnode.c
+29
-7
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/relnode.c
+1
-2
src/include/nodes/relation.h
src/include/nodes/relation.h
+1
-6
src/include/optimizer/geqo_paths.h
src/include/optimizer/geqo_paths.h
+2
-2
src/include/optimizer/paths.h
src/include/optimizer/paths.h
+2
-3
未找到文件。
src/backend/nodes/copyfuncs.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.6
7 1999/02/11 14:58:48
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.6
8 1999/02/12 05:56:45
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -1026,7 +1026,6 @@ _copyRelOptInfo(RelOptInfo * from)
...
@@ -1026,7 +1026,6 @@ _copyRelOptInfo(RelOptInfo * from)
newnode
->
width
=
from
->
width
;
newnode
->
width
=
from
->
width
;
Node_Copy
(
from
,
newnode
,
targetlist
);
Node_Copy
(
from
,
newnode
,
targetlist
);
Node_Copy
(
from
,
newnode
,
pathlist
);
Node_Copy
(
from
,
newnode
,
pathlist
);
Node_Copy
(
from
,
newnode
,
unorderedpath
);
Node_Copy
(
from
,
newnode
,
cheapestpath
);
Node_Copy
(
from
,
newnode
,
cheapestpath
);
newnode
->
pruneable
=
from
->
pruneable
;
newnode
->
pruneable
=
from
->
pruneable
;
...
...
src/backend/nodes/freefuncs.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.
7 1999/02/11 14:58:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/Attic/freefuncs.c,v 1.
8 1999/02/12 05:56:45
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -724,7 +724,6 @@ _freeRelOptInfo(RelOptInfo *node)
...
@@ -724,7 +724,6 @@ _freeRelOptInfo(RelOptInfo *node)
freeObject
(
node
->
targetlist
);
freeObject
(
node
->
targetlist
);
freeObject
(
node
->
pathlist
);
freeObject
(
node
->
pathlist
);
freeObject
(
node
->
unorderedpath
);
freeObject
(
node
->
cheapestpath
);
freeObject
(
node
->
cheapestpath
);
if
(
node
->
classlist
)
if
(
node
->
classlist
)
...
...
src/backend/nodes/outfuncs.c
浏览文件 @
3fdb9bb9
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: outfuncs.c,v 1.
69 1999/02/11 14:58:49
momjian Exp $
* $Id: outfuncs.c,v 1.
70 1999/02/12 05:56:46
momjian Exp $
*
*
* NOTES
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
* Every (plan) node in POSTGRES has an associated "out" routine which
...
@@ -879,8 +879,7 @@ _outRelOptInfo(StringInfo str, RelOptInfo *node)
...
@@ -879,8 +879,7 @@ _outRelOptInfo(StringInfo str, RelOptInfo *node)
*/
*/
appendStringInfo
(
str
,
appendStringInfo
(
str
,
" :unorderedpath @ 0x%x :cheapestpath @ 0x%x :pruneable %s :restrictinfo "
,
" :cheapestpath @ 0x%x :pruneable %s :restrictinfo "
,
(
int
)
node
->
unorderedpath
,
(
int
)
node
->
cheapestpath
,
(
int
)
node
->
cheapestpath
,
node
->
pruneable
?
"true"
:
"false"
);
node
->
pruneable
?
"true"
:
"false"
);
_outNode
(
str
,
node
->
restrictinfo
);
_outNode
(
str
,
node
->
restrictinfo
);
...
...
src/backend/nodes/readfuncs.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.5
4 1999/02/11 14:58:49
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.5
5 1999/02/12 05:56:46
momjian Exp $
*
*
* NOTES
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
* Most of the read functions for plan nodes are tested. (In fact, they
...
@@ -1334,12 +1334,6 @@ _readRelOptInfo()
...
@@ -1334,12 +1334,6 @@ _readRelOptInfo()
* This can be changed later, if necessary.
* This can be changed later, if necessary.
*/
*/
token
=
lsptok
(
NULL
,
&
length
);
/* get :unorderpath */
token
=
lsptok
(
NULL
,
&
length
);
/* get @ */
token
=
lsptok
(
NULL
,
&
length
);
/* now read it */
sscanf
(
token
,
"%x"
,
(
unsigned
int
*
)
&
local_node
->
unorderedpath
);
token
=
lsptok
(
NULL
,
&
length
);
/* get :cheapestpath */
token
=
lsptok
(
NULL
,
&
length
);
/* get :cheapestpath */
token
=
lsptok
(
NULL
,
&
length
);
/* get @ */
token
=
lsptok
(
NULL
,
&
length
);
/* get @ */
token
=
lsptok
(
NULL
,
&
length
);
/* now read it */
token
=
lsptok
(
NULL
,
&
length
);
/* now read it */
...
...
src/backend/optimizer/geqo/geqo_eval.c
浏览文件 @
3fdb9bb9
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: geqo_eval.c,v 1.2
7 1999/02/10 21:02:34
momjian Exp $
* $Id: geqo_eval.c,v 1.2
8 1999/02/12 05:56:47
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -161,8 +161,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *out
...
@@ -161,8 +161,7 @@ gimme_tree(Query *root, Gene *tour, int rel_count, int num_gene, RelOptInfo *out
new_rel
=
(
RelOptInfo
*
)
lfirst
(
new_rels
);
new_rel
=
(
RelOptInfo
*
)
lfirst
(
new_rels
);
rel_count
++
;
rel_count
++
;
/* process new_rel->cheapestpath, new_rel->unorderedpath */
geqo_set_cheapest
(
new_rel
);
geqo_rel_paths
(
new_rel
);
/* processing of other new_rel attributes */
/* processing of other new_rel attributes */
if
(
new_rel
->
size
<=
0
)
if
(
new_rel
->
size
<=
0
)
...
@@ -282,7 +281,6 @@ init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo * joininfo)
...
@@ -282,7 +281,6 @@ init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo * joininfo)
joinrel
->
width
=
0
;
joinrel
->
width
=
0
;
/* joinrel->targetlist = NIL;*/
/* joinrel->targetlist = NIL;*/
joinrel
->
pathlist
=
NIL
;
joinrel
->
pathlist
=
NIL
;
joinrel
->
unorderedpath
=
(
Path
*
)
NULL
;
joinrel
->
cheapestpath
=
(
Path
*
)
NULL
;
joinrel
->
cheapestpath
=
(
Path
*
)
NULL
;
joinrel
->
pruneable
=
true
;
joinrel
->
pruneable
=
true
;
joinrel
->
classlist
=
NULL
;
joinrel
->
classlist
=
NULL
;
...
...
src/backend/optimizer/geqo/geqo_paths.c
浏览文件 @
3fdb9bb9
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: geqo_paths.c,v 1.1
6 1999/02/11 14:58:50
momjian Exp $
* $Id: geqo_paths.c,v 1.1
7 1999/02/12 05:56:48
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
static
List
*
geqo_prune_rel
(
RelOptInfo
*
rel
,
List
*
other_rels
);
static
List
*
geqo_prune_rel
(
RelOptInfo
*
rel
,
List
*
other_rels
);
static
Path
*
set_paths
(
RelOptInfo
*
rel
,
Path
*
unorderedpath
);
/*
/*
* geqo-prune-rels--
* geqo-prune-rels--
...
@@ -92,62 +91,17 @@ geqo_prune_rel(RelOptInfo *rel, List *other_rels)
...
@@ -92,62 +91,17 @@ geqo_prune_rel(RelOptInfo *rel, List *other_rels)
}
}
/*
/*
* geqo-
rel-paths
--
* geqo-
set-cheapest
--
* For a relation 'rel' (which corresponds to a join
* For a relation 'rel' (which corresponds to a join
* relation), set pointers to the unordered path and cheapest paths
* relation), set pointers to the cheapest path
* (if the unordered path isn't the cheapest, it is pruned), and
* reset the relation's size field to reflect the join.
*
* Returns nothing of interest.
*
*/
*/
void
void
geqo_
rel_paths
(
RelOptInfo
*
rel
)
geqo_
set_cheapest
(
RelOptInfo
*
rel
)
{
{
List
*
y
=
NIL
;
JoinPath
*
cheapest
=
(
JoinPath
*
)
set_cheapest
(
rel
,
rel
->
pathlist
);
Path
*
path
=
(
Path
*
)
NULL
;
JoinPath
*
cheapest
=
(
JoinPath
*
)
NULL
;
rel
->
size
=
0
;
foreach
(
y
,
rel
->
pathlist
)
{
path
=
(
Path
*
)
lfirst
(
y
);
if
(
!
path
->
pathorder
->
ord
.
sortop
)
break
;
}
cheapest
=
(
JoinPath
*
)
set_paths
(
rel
,
path
);
if
(
IsA_JoinPath
(
cheapest
))
if
(
IsA_JoinPath
(
cheapest
))
rel
->
size
=
compute_joinrel_size
(
cheapest
);
rel
->
size
=
compute_joinrel_size
(
cheapest
);
}
/*
* set-path--
* Compares the unordered path for a relation with the cheapest path. If
* the unordered path is not cheapest, it is pruned.
*
* Resets the pointers in 'rel' for unordered and cheapest paths.
*
* Returns the cheapest path.
*
*/
static
Path
*
set_paths
(
RelOptInfo
*
rel
,
Path
*
unorderedpath
)
{
Path
*
cheapest
=
set_cheapest
(
rel
,
rel
->
pathlist
);
/* don't prune if not pruneable -- JMH, 11/23/92 */
if
(
unorderedpath
!=
cheapest
&&
rel
->
pruneable
)
{
rel
->
unorderedpath
=
(
Path
*
)
NULL
;
rel
->
pathlist
=
lremove
(
unorderedpath
,
rel
->
pathlist
);
}
else
else
rel
->
unorderedpath
=
(
Path
*
)
unorderedpath
;
rel
->
size
=
0
;
return
cheapest
;
}
}
src/backend/optimizer/path/allpaths.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.2
7 1999/02/10 21:02:36
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.2
8 1999/02/12 05:56:49
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -139,7 +139,7 @@ find_rel_paths(Query *root, List *rels)
...
@@ -139,7 +139,7 @@ find_rel_paths(Query *root, List *rels)
lastpath
=
rel
->
pathlist
;
lastpath
=
rel
->
pathlist
;
while
(
lnext
(
lastpath
)
!=
NIL
)
while
(
lnext
(
lastpath
)
!=
NIL
)
lastpath
=
lnext
(
lastpath
);
lastpath
=
lnext
(
lastpath
);
prune_rel_path
(
rel
,
(
Path
*
)
lfirst
(
lastpath
)
);
set_cheapest
(
rel
,
rel
->
pathlist
);
/*
/*
* if there is a qualification of sequential scan the selec. value
* if there is a qualification of sequential scan the selec. value
...
@@ -223,7 +223,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
...
@@ -223,7 +223,7 @@ find_join_paths(Query *root, List *outer_rels, int levels_needed)
xfunc_trypullup((RelOptInfo *) lfirst(x));
xfunc_trypullup((RelOptInfo *) lfirst(x));
#endif
#endif
prune_rel_paths
(
new_rels
);
rels_set_cheapest
(
new_rels
);
if
(
BushyPlanFlag
)
if
(
BushyPlanFlag
)
{
{
...
...
src/backend/optimizer/path/joinrels.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.1
8 1999/02/10 21:02:39
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/joinrels.c,v 1.1
9 1999/02/12 05:56:50
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -216,7 +216,6 @@ init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo * joininfo)
...
@@ -216,7 +216,6 @@ init_join_rel(RelOptInfo *outer_rel, RelOptInfo *inner_rel, JoinInfo * joininfo)
joinrel
->
width
=
0
;
joinrel
->
width
=
0
;
/* joinrel->targetlist = NIL;*/
/* joinrel->targetlist = NIL;*/
joinrel
->
pathlist
=
NIL
;
joinrel
->
pathlist
=
NIL
;
joinrel
->
unorderedpath
=
(
Path
*
)
NULL
;
joinrel
->
cheapestpath
=
(
Path
*
)
NULL
;
joinrel
->
cheapestpath
=
(
Path
*
)
NULL
;
joinrel
->
pruneable
=
true
;
joinrel
->
pruneable
=
true
;
joinrel
->
classlist
=
NULL
;
joinrel
->
classlist
=
NULL
;
...
...
src/backend/optimizer/path/prune.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.2
7 1999/02/11 14:58:54
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/Attic/prune.c,v 1.2
8 1999/02/12 05:56:51
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -77,42 +77,28 @@ prune_joinrel(RelOptInfo *rel, List *other_rels)
...
@@ -77,42 +77,28 @@ prune_joinrel(RelOptInfo *rel, List *other_rels)
rel
->
pathlist
,
rel
->
pathlist
,
other_rel
->
pathlist
);
other_rel
->
pathlist
);
else
else
result
=
nconc
(
result
,
lcons
(
other_rel
,
NIL
)
);
result
=
lappend
(
result
,
other_rel
);
}
}
return
result
;
return
result
;
}
}
/*
/*
*
prune-rel-paths--
*
rels-set-cheapest
* For each relation entry in 'rel-list' (which corresponds to a join
* For each relation entry in 'rel-list' (which corresponds to a join
* relation), set pointers to the unordered path and cheapest paths
* relation), set pointers to the cheapest path
* (if the unordered path isn't the cheapest, it is pruned), and
* reset the relation's size field to reflect the join.
*
* Returns nothing of interest.
*
*/
*/
void
void
prune_rel_paths
(
List
*
rel_list
)
rels_set_cheapest
(
List
*
rel_list
)
{
{
List
*
x
=
NIL
;
List
*
x
=
NIL
;
List
*
y
=
NIL
;
Path
*
path
=
NULL
;
RelOptInfo
*
rel
=
(
RelOptInfo
*
)
NULL
;
RelOptInfo
*
rel
=
(
RelOptInfo
*
)
NULL
;
JoinPath
*
cheapest
=
(
JoinPath
*
)
NULL
;
JoinPath
*
cheapest
;
foreach
(
x
,
rel_list
)
foreach
(
x
,
rel_list
)
{
{
rel
=
(
RelOptInfo
*
)
lfirst
(
x
);
rel
=
(
RelOptInfo
*
)
lfirst
(
x
);
rel
->
size
=
0
;
foreach
(
y
,
rel
->
pathlist
)
{
path
=
(
Path
*
)
lfirst
(
y
);
if
(
!
path
->
pathorder
->
ord
.
sortop
)
cheapest
=
(
JoinPath
*
)
set_cheapest
(
rel
,
rel
->
pathlist
);
break
;
}
cheapest
=
(
JoinPath
*
)
prune_rel_path
(
rel
,
path
);
if
(
IsA_JoinPath
(
cheapest
))
if
(
IsA_JoinPath
(
cheapest
))
rel
->
size
=
compute_joinrel_size
(
cheapest
);
rel
->
size
=
compute_joinrel_size
(
cheapest
);
else
else
...
@@ -121,33 +107,6 @@ prune_rel_paths(List *rel_list)
...
@@ -121,33 +107,6 @@ prune_rel_paths(List *rel_list)
}
}
/*
* prune-rel-path--
* Compares the unordered path for a relation with the cheapest path. If
* the unordered path is not cheapest, it is pruned.
*
* Resets the pointers in 'rel' for unordered and cheapest paths.
*
* Returns the cheapest path.
*
*/
Path
*
prune_rel_path
(
RelOptInfo
*
rel
,
Path
*
unorderedpath
)
{
Path
*
cheapest
=
set_cheapest
(
rel
,
rel
->
pathlist
);
/* don't prune if not pruneable -- JMH, 11/23/92 */
if
(
unorderedpath
!=
cheapest
&&
rel
->
pruneable
)
{
rel
->
unorderedpath
=
(
Path
*
)
NULL
;
rel
->
pathlist
=
lremove
(
unorderedpath
,
rel
->
pathlist
);
}
else
rel
->
unorderedpath
=
(
Path
*
)
unorderedpath
;
return
cheapest
;
}
/*
/*
* merge-joinrels--
* merge-joinrels--
* Given two lists of rel nodes that are already
* Given two lists of rel nodes that are already
...
...
src/backend/optimizer/util/indexnode.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.1
2 1999/02/10 21:02:40
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/indexnode.c,v 1.1
3 1999/02/12 05:56:55
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -78,7 +78,6 @@ find_secondary_index(Query *root, Oid relid)
...
@@ -78,7 +78,6 @@ find_secondary_index(Query *root, Oid relid)
indexnode
->
width
=
0
;
indexnode
->
width
=
0
;
indexnode
->
targetlist
=
NIL
;
indexnode
->
targetlist
=
NIL
;
indexnode
->
pathlist
=
NIL
;
indexnode
->
pathlist
=
NIL
;
indexnode
->
unorderedpath
=
NULL
;
indexnode
->
cheapestpath
=
NULL
;
indexnode
->
cheapestpath
=
NULL
;
indexnode
->
pruneable
=
true
;
indexnode
->
pruneable
=
true
;
indexnode
->
restrictinfo
=
NIL
;
indexnode
->
restrictinfo
=
NIL
;
...
...
src/backend/optimizer/util/pathnode.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.3
2 1999/02/12 02:37:52
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.3
3 1999/02/12 05:56:57
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -159,12 +159,21 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
...
@@ -159,12 +159,21 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
List
*
temp
=
NIL
;
List
*
temp
=
NIL
;
int
better_key
;
int
better_key
;
int
better_sort
;
int
better_sort
;
#ifdef OPTDUP_DEBUG
printf
(
"better_path entry
\n
"
);
printf
(
"new
\n
"
);
pprint
(
new_path
);
printf
(
"unique_paths
\n
"
);
pprint
(
unique_paths
);
#endif
foreach
(
temp
,
unique_paths
)
foreach
(
temp
,
unique_paths
)
{
{
path
=
(
Path
*
)
lfirst
(
temp
);
path
=
(
Path
*
)
lfirst
(
temp
);
#ifdef OPTDUP_DEBUG
#if 0
/*def OPTDUP_DEBUG*/
if (!pathkeys_match(new_path->pathkeys, path->pathkeys, &better_key) ||
if (!pathkeys_match(new_path->pathkeys, path->pathkeys, &better_key) ||
better_key != 0)
better_key != 0)
{
{
...
@@ -210,6 +219,13 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
...
@@ -210,6 +219,13 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
(
better_key
!=
2
&&
better_sort
==
1
))
&&
(
better_key
!=
2
&&
better_sort
==
1
))
&&
new_path
->
path_cost
<=
path
->
path_cost
))
new_path
->
path_cost
<=
path
->
path_cost
))
{
{
#ifdef OPTDUP_DEBUG
printf
(
"replace with new %p old %p better key %d better sort %d
\n
"
,
&
new_path
,
&
path
,
better_key
,
better_sort
);
printf
(
"old
\n
"
);
pprint
(
path
);
printf
(
"new
\n
"
);
pprint
(
new_path
);
#endif
*
is_new
=
false
;
*
is_new
=
false
;
return
path
;
return
path
;
}
}
...
@@ -223,12 +239,12 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
...
@@ -223,12 +239,12 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
(
better_key
!=
1
&&
better_sort
==
2
))
&&
(
better_key
!=
1
&&
better_sort
==
2
))
&&
new_path
->
path_cost
>=
path
->
path_cost
))
new_path
->
path_cost
>=
path
->
path_cost
))
{
{
#ifdef OPTDB_DEBUG
#ifdef OPTDUP_DEBUG
printf
(
"better key %d better sort %d
\n
"
,
better_key
,
better_sort
);
printf
(
"skip new %p old %p better key %d better sort %d
\n
"
,
&
new_path
,
&
path
,
better_key
,
better_sort
);
printf
(
"new
\n
"
);
pprint
(
new_path
);
printf
(
"old
\n
"
);
printf
(
"old
\n
"
);
pprint
(
path
);
pprint
(
path
);
printf
(
"new
\n
"
);
pprint
(
new_path
);
#endif
#endif
*
is_new
=
false
;
*
is_new
=
false
;
return
NULL
;
return
NULL
;
...
@@ -236,6 +252,12 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
...
@@ -236,6 +252,12 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
}
}
}
}
#ifdef OPTDUP_DEBUG
printf
(
"add new %p old %p better key %d better sort %d
\n
"
,
&
new_path
,
&
path
,
better_key
,
better_sort
);
printf
(
"new
\n
"
);
pprint
(
new_path
);
#endif
*
is_new
=
true
;
*
is_new
=
true
;
return
NULL
;
return
NULL
;
}
}
...
...
src/backend/optimizer/util/relnode.c
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.1
1 1999/02/09 17:03:01
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/relnode.c,v 1.1
2 1999/02/12 05:56:58
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -45,7 +45,6 @@ get_base_rel(Query *root, int relid)
...
@@ -45,7 +45,6 @@ get_base_rel(Query *root, int relid)
rel
->
width
=
0
;
rel
->
width
=
0
;
rel
->
targetlist
=
NIL
;
rel
->
targetlist
=
NIL
;
rel
->
pathlist
=
NIL
;
rel
->
pathlist
=
NIL
;
rel
->
unorderedpath
=
(
Path
*
)
NULL
;
rel
->
cheapestpath
=
(
Path
*
)
NULL
;
rel
->
cheapestpath
=
(
Path
*
)
NULL
;
rel
->
pruneable
=
true
;
rel
->
pruneable
=
true
;
rel
->
classlist
=
NULL
;
rel
->
classlist
=
NULL
;
...
...
src/include/nodes/relation.h
浏览文件 @
3fdb9bb9
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: relation.h,v 1.
19 1999/02/11 14:59:03
momjian Exp $
* $Id: relation.h,v 1.
20 1999/02/12 05:57:01
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -41,10 +41,6 @@ typedef List *Relid;
...
@@ -41,10 +41,6 @@ typedef List *Relid;
* targetlist - List of TargetList nodes
* targetlist - List of TargetList nodes
* pathlist - List of Path nodes, one for each possible method of
* pathlist - List of Path nodes, one for each possible method of
* generating the relation
* generating the relation
* unorderedpath - a Path node generating this relation whose resulting
* tuples are unordered (this isn't necessarily a
* sequential scan path, e.g., scanning with a hash index
* leaves the tuples unordered)
* cheapestpath - least expensive Path (regardless of final order)
* cheapestpath - least expensive Path (regardless of final order)
* pruneable - flag to let the planner know whether it can prune the plan
* pruneable - flag to let the planner know whether it can prune the plan
* space of this RelOptInfo or not.
* space of this RelOptInfo or not.
...
@@ -88,7 +84,6 @@ typedef struct RelOptInfo
...
@@ -88,7 +84,6 @@ typedef struct RelOptInfo
/* materialization information */
/* materialization information */
List
*
targetlist
;
List
*
targetlist
;
List
*
pathlist
;
/* Path structures */
List
*
pathlist
;
/* Path structures */
struct
Path
*
unorderedpath
;
struct
Path
*
cheapestpath
;
struct
Path
*
cheapestpath
;
bool
pruneable
;
bool
pruneable
;
...
...
src/include/optimizer/geqo_paths.h
浏览文件 @
3fdb9bb9
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: geqo_paths.h,v 1.
7 1999/02/10 21:02:47
momjian Exp $
* $Id: geqo_paths.h,v 1.
8 1999/02/12 05:57:06
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -23,6 +23,6 @@
...
@@ -23,6 +23,6 @@
extern
List
*
geqo_prune_rels
(
List
*
rel_list
);
extern
List
*
geqo_prune_rels
(
List
*
rel_list
);
extern
void
geqo_
rel_paths
(
RelOptInfo
*
rel
);
extern
void
geqo_
set_cheapest
(
RelOptInfo
*
rel
);
#endif
/* GEQO_PATHS_H */
#endif
/* GEQO_PATHS_H */
src/include/optimizer/paths.h
浏览文件 @
3fdb9bb9
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: paths.h,v 1.1
3 1999/02/10 21:02:49
momjian Exp $
* $Id: paths.h,v 1.1
4 1999/02/12 05:57:08
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -85,8 +85,7 @@ extern List *final_join_rels(List *join_rel_list);
...
@@ -85,8 +85,7 @@ extern List *final_join_rels(List *join_rel_list);
* prototypes for path/prune.c
* prototypes for path/prune.c
*/
*/
extern
void
prune_joinrels
(
List
*
rel_list
);
extern
void
prune_joinrels
(
List
*
rel_list
);
extern
void
prune_rel_paths
(
List
*
rel_list
);
extern
void
rels_set_cheapest
(
List
*
rel_list
);
extern
Path
*
prune_rel_path
(
RelOptInfo
*
rel
,
Path
*
unorderedpath
);
extern
List
*
merge_joinrels
(
List
*
rel_list1
,
List
*
rel_list2
);
extern
List
*
merge_joinrels
(
List
*
rel_list1
,
List
*
rel_list2
);
extern
List
*
prune_oldrels
(
List
*
old_rels
);
extern
List
*
prune_oldrels
(
List
*
old_rels
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录