Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1cc29fe

Browse files
committed
Teach EXPLAIN to print PARAM_EXEC Params as the referenced expressions,
rather than just $N. This brings the display of nestloop-inner-indexscanplans back to where it's been, and incidentally improves the display ofSubPlan parameters as well. In passing, simplify the EXPLAIN code byhaving it deal primarily in the PlanState tree rather than separatelysearching Plan and PlanState trees. This is noticeably cleaner forsubplans, and about a wash elsewhere.One small difference from previous behavior is that EXPLAIN will no longerqualify local variable references in inner-indexscan plan nodes, since itno longer sees such nodes as possibly referencing multiple tables. Varsreferenced through PARAM_EXEC Params are still forcibly qualified, though,so I don't think the display is any more confusing than before. Adjust acouple of examples in the documentation to match this behavior.
1 parent4504a1b commit1cc29fe

File tree

5 files changed

+481
-286
lines changed

5 files changed

+481
-286
lines changed

‎doc/src/sgml/perform.sgml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.82 2010/06/28 22:46:11 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.83 2010/07/13 20:57:19 tgl Exp $ -->
22

33
<chapter id="performance-tips">
44
<title>Performance Tips</title>
@@ -316,7 +316,7 @@ WHERE t1.unique1 &lt; 100 AND t1.unique2 = t2.unique2;
316316
-&gt; Bitmap Index Scan on tenk1_unique1 (cost=0.00..2.37 rows=106 width=0)
317317
Index Cond: (unique1 &lt; 100)
318318
-&gt; Index Scan using tenk2_unique2 on tenk2 t2 (cost=0.00..3.01 rows=1 width=244)
319-
Index Cond: (t2.unique2 = t1.unique2)
319+
Index Cond: (unique2 = t1.unique2)
320320
</programlisting>
321321
</para>
322322

@@ -329,7 +329,7 @@ WHERE t1.unique1 &lt; 100 AND t1.unique2 = t2.unique2;
329329
so it doesn't affect the row count of the outer scan. For the inner (lower) scan, the
330330
<literal>unique2</> value of the current outer-scan row is plugged into
331331
the inner index scan to produce an index condition like
332-
<literal>t2.unique2 = <replaceable>constant</replaceable></literal>.
332+
<literal>unique2 = <replaceable>constant</replaceable></literal>.
333333
So we get the same inner-scan plan and costs that we'd get from, say,
334334
<literal>EXPLAIN SELECT * FROM tenk2 WHERE unique2 = 42</literal>. The
335335
costs of the loop node are then set on the basis of the cost of the outer
@@ -405,7 +405,7 @@ WHERE t1.unique1 &lt; 100 AND t1.unique2 = t2.unique2;
405405
-&gt; Bitmap Index Scan on tenk1_unique1 (cost=0.00..2.37 rows=106 width=0) (actual time=0.546..0.546 rows=100 loops=1)
406406
Index Cond: (unique1 &lt; 100)
407407
-&gt; Index Scan using tenk2_unique2 on tenk2 t2 (cost=0.00..3.01 rows=1 width=244) (actual time=0.067..0.078 rows=1 loops=100)
408-
Index Cond: (t2.unique2 = t1.unique2)
408+
Index Cond: (unique2 = t1.unique2)
409409
Total runtime: 14.452 ms
410410
</screen>
411411

‎doc/src/sgml/planstats.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/planstats.sgml,v 1.9 2007/12/28 21:03:31 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/planstats.sgml,v 1.10 2010/07/13 20:57:19 tgl Exp $ -->
22

33
<chapter id="planner-stats-details">
44
<title>How the Planner Uses Statistics</title>
@@ -353,7 +353,7 @@ WHERE t1.unique1 &lt; 50 AND t1.unique2 = t2.unique2;
353353
-&gt; Bitmap Index Scan on tenk1_unique1 (cost=0.00..4.63 rows=50 width=0)
354354
Index Cond: (unique1 &lt; 50)
355355
-&gt; Index Scan using tenk2_unique2 on tenk2 t2 (cost=0.00..6.27 rows=1 width=244)
356-
Index Cond: (t2.unique2 = t1.unique2)
356+
Index Cond: (unique2 = t1.unique2)
357357
</programlisting>
358358

359359
The restriction on <structname>tenk1</structname>,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp