1
1
<!--
2
- $Header: /cvsroot/pgsql/doc/src/sgml/Attic/plan.sgml,v 2.2 2000/03/31 03:27:41 thomas Exp $
2
+ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/plan.sgml,v 2.3 2000/03/31 17:45:00 tgl Exp $
3
3
-->
4
4
5
5
<chapter>
@@ -31,7 +31,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/plan.sgml,v 2.2 2000/03/31 03:27:41 t
31
31
32
32
<para>
33
33
Plan-reading is an art that deserves a tutorial, and I haven't
34
- had time to write one. Here is some quick & dirty explanation.
34
+ had time to write one. Here is some quick & dirty explanation.
35
35
</para>
36
36
37
37
<para>
@@ -69,9 +69,10 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/plan.sgml,v 2.2 2000/03/31 03:27:41 t
69
69
</para>
70
70
71
71
<para>
72
- The costs are measured in units of disk page fetches. (There are some
73
- fairly bogus fudge-factors for converting CPU effort estimates into
74
- disk-fetch units; see the SET ref page if you want to play with these.)
72
+ The costs are measured in units of disk page fetches. (CPU effort
73
+ estimates are converted into disk-page units using some
74
+ fairly arbitrary fudge-factors. See the <command>SET</command>
75
+ reference page if you want to experiment with these.)
75
76
It's important to note that the cost of an upper-level node includes
76
77
the cost of all its child nodes. It's also important to realize that
77
78
the cost only reflects things that the planner/optimizer cares about.
@@ -83,7 +84,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/plan.sgml,v 2.2 2000/03/31 03:27:41 t
83
84
</para>
84
85
85
86
<para>
86
- Rows output is a little tricky because it is * not* the number of rows
87
+ Rows output is a little tricky because it is <emphasis> not</emphasis> the number of rows
87
88
processed/scanned by the query --- it is usually less, reflecting the
88
89
estimated selectivity of any WHERE-clause constraints that are being
89
90
applied at this node.
@@ -98,7 +99,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/Attic/plan.sgml,v 2.2 2000/03/31 03:27:41 t
98
99
99
100
<para>
100
101
Here are some examples (using the regress test database after a
101
- vacuum analyze, and current sources):
102
+ vacuum analyze, and almost-7.0 sources):
102
103
103
104
<programlisting>
104
105
regression=# explain select * from tenk1;
@@ -109,7 +110,7 @@ Seq Scan on tenk1 (cost=0.00..333.00 rows=10000 width=148)
109
110
</para>
110
111
111
112
<para>
112
- About as straightforward as it gets. If you do
113
+ This is about as straightforward as it gets. If you do
113
114
114
115
<programlisting>
115
116
select * from pg_class where relname = 'tenk1';
@@ -131,7 +132,7 @@ NOTICE: QUERY PLAN:
131
132
Seq Scan on tenk1 (cost=0.00..358.00 rows=1000 width=148)
132
133
</programlisting>
133
134
134
- Estimated output rows has gone down because of the WHERE clause.
135
+ The estimate of output rows has gone down because of the WHERE clause.
135
136
(The uncannily accurate estimate is just because tenk1 is a particularly
136
137
simple case --- the unique1 column has 10000 distinct values ranging
137
138
from 0 to 9999, so the estimator's linear interpolation between min and
@@ -191,10 +192,11 @@ Nested Loop (cost=0.00..144.07 rows=100 width=296)
191
192
192
193
<para>
193
194
In this nested-loop join, the outer scan is the same indexscan we had
194
- in the example before last, and the cost and row count are the same
195
- because we are applying the "unique1 < 100" WHERE clause at this node.
195
+ in the example before last, and so its cost and row count are the same
196
+ because we are applying the "unique1 < 100" WHERE clause at that node.
196
197
The "t1.unique2 = t2.unique2" clause isn't relevant yet, so it doesn't
197
- affect the row count. For the inner scan, we assume that the current
198
+ affect the outer scan's row count. For the inner scan, the
199
+ current
198
200
outer-scan tuple's unique2 value is plugged into the inner indexscan
199
201
to produce an indexqual like
200
202
"t2.unique2 = <replaceable>constant</replaceable>". So we get the
@@ -221,7 +223,7 @@ Nested Loop (cost=0.00..144.07 rows=100 width=296)
221
223
but it's what we've got at the moment):
222
224
223
225
<programlisting>
224
- regression=# set enable_nestloop = ' off' ;
226
+ regression=# set enable_nestloop = off;
225
227
SET VARIABLE
226
228
regression=# explain select * from tenk1 t1, tenk2 t2 where t1.unique1 < 100
227
229
regression-# and t1.unique2 = t2.unique2;
0 commit comments