Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
75cccd0a
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,发现更多精彩内容 >>
提交
75cccd0a
编写于
2月 20, 1999
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pathkeys fixes
上级
0ff27333
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
24 deletion
+55
-24
src/backend/nodes/print.c
src/backend/nodes/print.c
+15
-7
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/path/pathkeys.c
+36
-12
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/pathnode.c
+2
-2
src/include/nodes/relation.h
src/include/nodes/relation.h
+2
-3
未找到文件。
src/backend/nodes/print.c
浏览文件 @
75cccd0a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.2
2 1999/02/13 23:16:0
0 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.2
3 1999/02/20 19:02:4
0 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -213,20 +213,28 @@ print_expr(Node *expr, List *rtable)
/*
* print_pathkeys -
*
temporary here. where is keys list of list
s
*
pathkeys list of list of Var'
s
*/
void
print_pathkeys
(
List
*
pathkeys
,
List
*
rtable
)
{
List
*
k
;
List
*
i
,
*
k
;
printf
(
"("
);
foreach
(
k
,
pathkeys
)
foreach
(
i
,
pathkeys
)
{
Node
*
var
=
lfirst
((
List
*
)
lfirst
(
k
));
List
pathkey
=
lfirst
(
i
));
print_expr
(
var
,
rtable
);
if
(
lnext
(
k
))
printf
(
"("
);
foreach
(
k
,
pathkey
)
{
Node
*
var
=
lfirst
(
k
);
print_expr
(
var
,
rtable
);
if
(
lnext
(
k
))
printf
(
", "
);
}
printf
(
") "
);
if
(
lnext
(
i
))
printf
(
", "
);
}
printf
(
")
\n
"
);
...
...
src/backend/optimizer/path/pathkeys.c
浏览文件 @
75cccd0a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.
4 1999/02/20 18:01:0
1 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/pathkeys.c,v 1.
5 1999/02/20 19:02:4
1 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -54,7 +54,19 @@ static List *new_matching_subkeys(Var *subkey, List *considered_subkeys,
* { {tab1.col1, tab2.col1} }. This allows future joins to use either Var
* as a pre-sorted key to prevent Mergejoins from having to re-sort the Path.
* They are equal, so they are both primary sort keys. This is why pathkeys
* is a List of Lists. -- bjm
* is a List of Lists.
*
* For multi-key sorts, if the outer is sorted by a multi-key index, the
* multi-key index remains after the join. If the inner has a multi-key
* sort, only the primary key of the inner is added to the result.
* Mergejoins only join on the primary key. Currently, non-primary keys
* in the pathkeys List are of limited value.
*
* HashJoin has similar functionality. NestJoin does not perform sorting,
* and allows non-equajoins, so it does not allow useful pathkeys.
*
* -- bjm
*
*/
/****************************************************************************
...
...
@@ -92,10 +104,10 @@ static List *new_matching_subkeys(Var *subkey, List *considered_subkeys,
*/
List
*
order_joinkeys_by_pathkeys
(
List
*
pathkeys
,
List
*
joinkeys
,
List
*
joinclauses
,
int
outer_or_inner
,
List
**
matchedJoinClausesPtr
)
List
*
joinkeys
,
List
*
joinclauses
,
int
outer_or_inner
,
List
**
matchedJoinClausesPtr
)
{
List
*
matched_joinkeys
=
NIL
;
List
*
matched_joinclauses
=
NIL
;
...
...
@@ -103,6 +115,10 @@ order_joinkeys_by_pathkeys(List *pathkeys,
List
*
i
=
NIL
;
int
matched_joinkey_index
=
-
1
;
/*
* Reorder the joinkeys by picking out one that matches each pathkey,
* and create a new joinkey/joinclause list in pathkey order
*/
foreach
(
i
,
pathkeys
)
{
pathkey
=
lfirst
(
i
);
...
...
@@ -118,10 +134,18 @@ order_joinkeys_by_pathkeys(List *pathkeys,
matched_joinclauses
=
lappend
(
matched_joinclauses
,
joinclause
);
}
else
{
/* A pathkey could not be matched. */
break
;
}
/*
* Did we fail to match all the joinkeys?
* Extra pathkeys are no problem.
*/
if
(
length
(
joinkeys
)
!=
length
(
matched_joinkeys
))
{
*
matchedJoinClausesPtr
=
NIL
;
return
NIL
;
}
}
*
matchedJoinClausesPtr
=
matched_joinclauses
;
...
...
@@ -133,6 +157,8 @@ order_joinkeys_by_pathkeys(List *pathkeys,
* match_pathkey_joinkeys
* Returns the 0-based index into 'joinkeys' of the first joinkey whose
* outer or inner subkey matches any subkey of 'pathkey'.
*
* All these keys are equivalent, so any of them can match. See above.
*/
static
int
match_pathkey_joinkeys
(
List
*
pathkey
,
...
...
@@ -141,8 +167,7 @@ match_pathkey_joinkeys(List *pathkey,
{
Var
*
path_subkey
;
int
pos
;
List
*
i
=
NIL
;
List
*
x
=
NIL
;
List
*
i
,
*
x
;
JoinKey
*
jk
;
foreach
(
i
,
pathkey
)
...
...
@@ -152,8 +177,7 @@ match_pathkey_joinkeys(List *pathkey,
foreach
(
x
,
joinkeys
)
{
jk
=
(
JoinKey
*
)
lfirst
(
x
);
if
(
var_equal
(
path_subkey
,
extract_join_key
(
jk
,
outer_or_inner
)))
if
(
var_equal
(
path_subkey
,
extract_join_key
(
jk
,
outer_or_inner
)))
return
pos
;
pos
++
;
}
...
...
src/backend/optimizer/util/pathnode.c
浏览文件 @
75cccd0a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.3
8 1999/02/20 18:01:0
2 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.3
9 1999/02/20 19:02:4
2 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -205,7 +205,7 @@ better_path(Path *new_path, List *unique_paths, bool *is_new)
{
/*
* Replace pathkeys that match exactly, {{1,2}}, {{1,2}}
* Replace pathkeys {{1,2}}with {{1,2,3}}} if the latter is not
* Replace pathkeys {{1,2}}
with {{1,2,3}}} if the latter is not
* more expensive and replace unordered path with ordered
* path if it is not more expensive. Favor sorted keys
* over unsorted keys in the same way.
...
...
src/include/nodes/relation.h
浏览文件 @
75cccd0a
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: relation.h,v 1.2
7 1999/02/20 16:28:20
momjian Exp $
* $Id: relation.h,v 1.2
8 1999/02/20 19:02:43
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -142,8 +142,7 @@ typedef struct Path
PathOrder
*
pathorder
;
List
*
pathkeys
;
/*
* This is a List of List of Var nodes.
List
*
pathkeys
;
/* This is a List of List of Var nodes.
* See the top of optimizer/path/pathkeys.c
* for more information.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录