11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.19 2002/03/2404:31:05 tgl Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/perform.sgml,v 1.20 2002/03/2417:11:37 tgl Exp $
33-->
44
55 <chapter id="performance-tips">
@@ -116,7 +116,7 @@ SELECT * FROM pg_class WHERE relname = 'tenk1';
116116 </para>
117117
118118 <para>
119- Now let's modify the query to add aqualification clause :
119+ Now let's modify the query to add aWHERE condition :
120120
121121 <programlisting>
122122regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 1000;
@@ -142,14 +142,14 @@ regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 1000;
142142 </para>
143143
144144 <para>
145- Modify the query to restrict thequalification even more:
145+ Modify the query to restrict thecondition even more:
146146
147147 <programlisting>
148148regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 50;
149149 QUERY PLAN
150150-------------------------------------------------------------------------------
151151 Index Scan using tenk1_unique1 on tenk1 (cost=0.00..179.33 rows=49 width=148)
152- IndexFilter : (unique1 < 50)
152+ IndexCond : (unique1 < 50)
153153 </programlisting>
154154
155155 and you will see that if we make the WHERE condition selective
@@ -161,15 +161,15 @@ regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 50;
161161 </para>
162162
163163 <para>
164- Add anothercondition to thequalification :
164+ Add anotherclause to theWHERE condition :
165165
166166 <programlisting>
167167regression=# EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 50 AND
168168regression-# stringu1 = 'xxx';
169169 QUERY PLAN
170170-------------------------------------------------------------------------------
171171 Index Scan using tenk1_unique1 on tenk1 (cost=0.00..179.45 rows=1 width=148)
172- IndexFilter : (unique1 < 50)
172+ IndexCond : (unique1 < 50)
173173 Filter: (stringu1 = 'xxx'::name)
174174 </programlisting>
175175
@@ -193,10 +193,10 @@ regression-# AND t1.unique2 = t2.unique2;
193193 Nested Loop (cost=0.00..327.02 rows=49 width=296)
194194 -> Index Scan using tenk1_unique1 on tenk1 t1
195195 (cost=0.00..179.33 rows=49 width=148)
196- IndexFilter : (unique1 < 50)
196+ IndexCond : (unique1 < 50)
197197 -> Index Scan using tenk2_unique2 on tenk2 t2
198198 (cost=0.00..3.01 rows=1 width=148)
199- IndexFilter : ("outer".unique2 = t2.unique2)
199+ IndexCond : ("outer".unique2 = t2.unique2)
200200 </programlisting>
201201 </para>
202202
@@ -208,7 +208,7 @@ regression-# AND t1.unique2 = t2.unique2;
208208 affect row count of the outer scan. For the inner scan, the unique2 value of the
209209 current
210210 outer-scan tuple is plugged into the inner index scan
211- to produce an indexqualification like
211+ to produce an indexcondition like
212212 <literal>t2.unique2 = <replaceable>constant</replaceable></literal>. So we get the
213213 same inner-scan plan and costs that we'd get from, say, <literal>explain select
214214 * 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;
246246 -> Hash (cost=179.33..179.33 rows=49 width=148)
247247 -> Index Scan using tenk1_unique1 on tenk1 t1
248248 (cost=0.00..179.33 rows=49 width=148)
249- IndexFilter : (unique1 < 50)
249+ IndexCond : (unique1 < 50)
250250 </programlisting>
251251
252252 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;
279279 -> Index Scan using tenk1_unique1 on tenk1 t1
280280 (cost=0.00..179.33 rows=49 width=148)
281281 (actual time=0.63..8.91 rows=50 loops=1)
282- IndexFilter : (unique1 < 50)
282+ IndexCond : (unique1 < 50)
283283 -> Index Scan using tenk2_unique2 on tenk2 t2
284284 (cost=0.00..3.01 rows=1 width=148)
285285 (actual time=0.29..0.32 rows=1 loops=50)
286- IndexFilter : ("outer".unique2 = t2.unique2)
286+ IndexCond : ("outer".unique2 = t2.unique2)
287287 Total runtime: 31.60 msec
288288</screen>
289289