Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
ea10ec1b
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,发现更多精彩内容 >>
提交
ea10ec1b
编写于
3月 24, 2002
作者:
T
Tom Lane
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tweak labeling of plan qual conditions for more consistency.
上级
7100cbc1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
20 deletion
+20
-20
doc/src/sgml/perform.sgml
doc/src/sgml/perform.sgml
+12
-12
doc/src/sgml/ref/explain.sgml
doc/src/sgml/ref/explain.sgml
+3
-3
src/backend/commands/explain.c
src/backend/commands/explain.c
+5
-5
未找到文件。
doc/src/sgml/perform.sgml
浏览文件 @
ea10ec1b
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.
19 2002/03/24 04:31:05
tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.
20 2002/03/24 17:11:37
tgl Exp $
-->
<chapter id="performance-tips">
...
...
@@ -116,7 +116,7 @@ SELECT * FROM pg_class WHERE relname = 'tenk1';
</para>
<para>
Now let's modify the query to add a
qualification clause
:
Now let's modify the query to add a
WHERE condition
:
<programlisting>
regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 1000;
...
...
@@ -142,14 +142,14 @@ regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 1000;
</para>
<para>
Modify the query to restrict the
qualifica
tion even more:
Modify the query to restrict the
condi
tion even more:
<programlisting>
regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 50;
QUERY PLAN
-------------------------------------------------------------------------------
Index Scan using tenk1_unique1 on tenk1 (cost=0.00..179.33 rows=49 width=148)
Index
Filter
: (unique1 < 50)
Index
Cond
: (unique1 < 50)
</programlisting>
and you will see that if we make the WHERE condition selective
...
...
@@ -161,7 +161,7 @@ regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 50;
</para>
<para>
Add another c
ondition to the qualifica
tion:
Add another c
lause to the WHERE condi
tion:
<programlisting>
regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 50 AND
...
...
@@ -169,7 +169,7 @@ regression-# stringu1 = 'xxx';
QUERY PLAN
-------------------------------------------------------------------------------
Index Scan using tenk1_unique1 on tenk1 (cost=0.00..179.45 rows=1 width=148)
Index
Filter
: (unique1 < 50)
Index
Cond
: (unique1 < 50)
Filter: (stringu1 = 'xxx'::name)
</programlisting>
...
...
@@ -193,10 +193,10 @@ regression-# AND t1.unique2 = t2.unique2;
Nested Loop (cost=0.00..327.02 rows=49 width=296)
-> Index Scan using tenk1_unique1 on tenk1 t1
(cost=0.00..179.33 rows=49 width=148)
Index
Filter
: (unique1 < 50)
Index
Cond
: (unique1 < 50)
-> Index Scan using tenk2_unique2 on tenk2 t2
(cost=0.00..3.01 rows=1 width=148)
Index
Filter
: ("outer".unique2 = t2.unique2)
Index
Cond
: ("outer".unique2 = t2.unique2)
</programlisting>
</para>
...
...
@@ -208,7 +208,7 @@ regression-# AND t1.unique2 = t2.unique2;
affect row count of the outer scan. For the inner scan, the unique2 value of the
current
outer-scan tuple is plugged into the inner index scan
to produce an index
qualifica
tion like
to produce an index
condi
tion like
<literal>t2.unique2 = <replaceable>constant</replaceable></literal>. So we get the
same inner-scan plan and costs that we'd get from, say, <literal>explain select
* from tenk2 where unique2 = 42</literal>. The costs of the loop node are then set
...
...
@@ -246,7 +246,7 @@ regression-# AND t1.unique2 = t2.unique2;
-> Hash (cost=179.33..179.33 rows=49 width=148)
-> Index Scan using tenk1_unique1 on tenk1 t1
(cost=0.00..179.33 rows=49 width=148)
Index
Filter
: (unique1 < 50)
Index
Cond
: (unique1 < 50)
</programlisting>
This plan proposes to extract the 50 interesting rows of <classname>tenk1</classname>
...
...
@@ -279,11 +279,11 @@ regression-# WHERE t1.unique1 < 50 AND t1.unique2 = t2.unique2;
-> Index Scan using tenk1_unique1 on tenk1 t1
(cost=0.00..179.33 rows=49 width=148)
(actual time=0.63..8.91 rows=50 loops=1)
Index
Filter
: (unique1 < 50)
Index
Cond
: (unique1 < 50)
-> Index Scan using tenk2_unique2 on tenk2 t2
(cost=0.00..3.01 rows=1 width=148)
(actual time=0.29..0.32 rows=1 loops=50)
Index
Filter
: ("outer".unique2 = t2.unique2)
Index
Cond
: ("outer".unique2 = t2.unique2)
Total runtime: 31.60 msec
</screen>
...
...
doc/src/sgml/ref/explain.sgml
浏览文件 @
ea10ec1b
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/explain.sgml,v 1.1
8 2002/03/24 16:57:29
tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/explain.sgml,v 1.1
9 2002/03/24 17:11:37
tgl Exp $
PostgreSQL documentation
-->
...
...
@@ -209,7 +209,7 @@ EXPLAIN SELECT * FROM foo WHERE i = 4;
QUERY PLAN
--------------------------------------------------------------
Index Scan using fi on foo (cost=0.00..5.98 rows=1 width=4)
Index
Filter
: (i = 4)
Index
Cond
: (i = 4)
(2 rows)
</computeroutput>
</programlisting>
...
...
@@ -226,7 +226,7 @@ EXPLAIN SELECT sum(i) FROM foo WHERE i < 10;
---------------------------------------------------------------------
Aggregate (cost=23.93..23.93 rows=1 width=4)
-> Index Scan using fi on foo (cost=0.00..23.92 rows=6 width=4)
Index
Filter
: (i < 10)
Index
Cond
: (i < 10)
(3 rows)
</computeroutput>
</programlisting>
...
...
src/backend/commands/explain.c
浏览文件 @
ea10ec1b
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.7
4 2002/03/24 04:31:07
tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.7
5 2002/03/24 17:11:36
tgl Exp $
*
*/
...
...
@@ -389,7 +389,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
{
case
T_IndexScan
:
show_scan_qual
(((
IndexScan
*
)
plan
)
->
indxqualorig
,
true
,
"Index
Filter
"
,
"Index
Cond
"
,
((
Scan
*
)
plan
)
->
scanrelid
,
outer_plan
,
str
,
indent
,
es
);
...
...
@@ -409,7 +409,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
break
;
case
T_NestLoop
:
show_upper_qual
(((
NestLoop
*
)
plan
)
->
join
.
joinqual
,
"Join
Cond
"
,
"Join
Filter
"
,
"outer"
,
OUTER
,
outerPlan
(
plan
),
"inner"
,
INNER
,
innerPlan
(
plan
),
str
,
indent
,
es
);
...
...
@@ -426,7 +426,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
"inner"
,
INNER
,
innerPlan
(
plan
),
str
,
indent
,
es
);
show_upper_qual
(((
MergeJoin
*
)
plan
)
->
join
.
joinqual
,
"Join
Cond
"
,
"Join
Filter
"
,
"outer"
,
OUTER
,
outerPlan
(
plan
),
"inner"
,
INNER
,
innerPlan
(
plan
),
str
,
indent
,
es
);
...
...
@@ -443,7 +443,7 @@ explain_outNode(StringInfo str, Plan *plan, Plan *outer_plan,
"inner"
,
INNER
,
innerPlan
(
plan
),
str
,
indent
,
es
);
show_upper_qual
(((
HashJoin
*
)
plan
)
->
join
.
joinqual
,
"Join
Cond
"
,
"Join
Filter
"
,
"outer"
,
OUTER
,
outerPlan
(
plan
),
"inner"
,
INNER
,
innerPlan
(
plan
),
str
,
indent
,
es
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录