diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-13 20:57:19 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-13 20:57:19 +0000 |
commit | 1cc29fe7c60ba643c114979dbe588d3a38005449 (patch) | |
tree | 432913ae6834cea94e9dced0dfdfab2329b0a090 /doc/src | |
parent | 4504a1bc017ff006c129dfce3e691f0d9b29a0c3 (diff) | |
download | postgresql-1cc29fe7c60ba643c114979dbe588d3a38005449.tar.gz postgresql-1cc29fe7c60ba643c114979dbe588d3a38005449.zip |
Teach EXPLAIN to print PARAM_EXEC Params as the referenced expressions,
rather than just $N. This brings the display of nestloop-inner-indexscan
plans back to where it's been, and incidentally improves the display of
SubPlan parameters as well. In passing, simplify the EXPLAIN code by
having it deal primarily in the PlanState tree rather than separately
searching Plan and PlanState trees. This is noticeably cleaner for
subplans, and about a wash elsewhere.
One small difference from previous behavior is that EXPLAIN will no longer
qualify local variable references in inner-indexscan plan nodes, since it
no longer sees such nodes as possibly referencing multiple tables. Vars
referenced through PARAM_EXEC Params are still forcibly qualified, though,
so I don't think the display is any more confusing than before. Adjust a
couple of examples in the documentation to match this behavior.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/perform.sgml | 8 | ||||
-rw-r--r-- | doc/src/sgml/planstats.sgml | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/doc/src/sgml/perform.sgml b/doc/src/sgml/perform.sgml index b69813cedba..014a91b1e9e 100644 --- a/doc/src/sgml/perform.sgml +++ b/doc/src/sgml/perform.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.82 2010/06/28 22:46:11 momjian Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/perform.sgml,v 1.83 2010/07/13 20:57:19 tgl Exp $ --> <chapter id="performance-tips"> <title>Performance Tips</title> @@ -316,7 +316,7 @@ WHERE t1.unique1 < 100 AND t1.unique2 = t2.unique2; -> Bitmap Index Scan on tenk1_unique1 (cost=0.00..2.37 rows=106 width=0) Index Cond: (unique1 < 100) -> Index Scan using tenk2_unique2 on tenk2 t2 (cost=0.00..3.01 rows=1 width=244) - Index Cond: (t2.unique2 = t1.unique2) + Index Cond: (unique2 = t1.unique2) </programlisting> </para> @@ -329,7 +329,7 @@ WHERE t1.unique1 < 100 AND t1.unique2 = t2.unique2; so it doesn't affect the row count of the outer scan. For the inner (lower) scan, the <literal>unique2</> value of the current outer-scan row is plugged into the inner index scan to produce an index condition like - <literal>t2.unique2 = <replaceable>constant</replaceable></literal>. + <literal>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 on the basis of the cost of the outer @@ -405,7 +405,7 @@ WHERE t1.unique1 < 100 AND t1.unique2 = t2.unique2; -> 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) Index Cond: (unique1 < 100) -> 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) - Index Cond: (t2.unique2 = t1.unique2) + Index Cond: (unique2 = t1.unique2) Total runtime: 14.452 ms </screen> diff --git a/doc/src/sgml/planstats.sgml b/doc/src/sgml/planstats.sgml index 1d6e52afd9a..7d9cb399784 100644 --- a/doc/src/sgml/planstats.sgml +++ b/doc/src/sgml/planstats.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/planstats.sgml,v 1.9 2007/12/28 21:03:31 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/planstats.sgml,v 1.10 2010/07/13 20:57:19 tgl Exp $ --> <chapter id="planner-stats-details"> <title>How the Planner Uses Statistics</title> @@ -353,7 +353,7 @@ WHERE t1.unique1 < 50 AND t1.unique2 = t2.unique2; -> Bitmap Index Scan on tenk1_unique1 (cost=0.00..4.63 rows=50 width=0) Index Cond: (unique1 < 50) -> Index Scan using tenk2_unique2 on tenk2 t2 (cost=0.00..6.27 rows=1 width=244) - Index Cond: (t2.unique2 = t1.unique2) + Index Cond: (unique2 = t1.unique2) </programlisting> The restriction on <structname>tenk1</structname>, |