summaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/explain.sgml
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2014-01-29 16:04:19 -0500
committerRobert Haas <rhaas@postgresql.org>2014-01-29 16:09:15 -0500
commit9347baa5bbc70368f2f01438bbb8116863dac1ec (patch)
treed39dd1fe9188f59ebd7b17810afb30c20e6c8b6d /doc/src/sgml/ref/explain.sgml
parent5264d9154178d3aeaa0359b43a450298a7ce7281 (diff)
Include planning time in EXPLAIN ANALYZE output.
This doesn't work for prepared queries, but it's not too easy to get the information in that case and there's some debate as to exactly what the right thing to measure is, so just do this for now. Andreas Karlsson, with slight doc changes by me.
Diffstat (limited to 'doc/src/sgml/ref/explain.sgml')
-rw-r--r--doc/src/sgml/ref/explain.sgml17
1 files changed, 12 insertions, 5 deletions
diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml
index 35264dcc72c..0f579fb161f 100644
--- a/doc/src/sgml/ref/explain.sgml
+++ b/doc/src/sgml/ref/explain.sgml
@@ -145,7 +145,8 @@ ROLLBACK;
<para>
Include information on the estimated startup and total cost of each
plan node, as well as the estimated number of rows and the estimated
- width of each row. This parameter defaults to <literal>TRUE</literal>.
+ width of each row. Also, include the time spent planning the query,
+ if available. This parameter defaults to <literal>TRUE</literal>.
</para>
</listitem>
</varlistentry>
@@ -289,7 +290,8 @@ EXPLAIN SELECT * FROM foo;
QUERY PLAN
---------------------------------------------------------
Seq Scan on foo (cost=0.00..155.00 rows=10000 width=4)
-(1 row)
+ Planning time: 0.114 ms
+(2 rows)
</programlisting>
</para>
@@ -309,7 +311,8 @@ EXPLAIN (FORMAT JSON) SELECT * FROM foo;
"Total Cost": 155.00, +
"Plan Rows": 10000, +
"Plan Width": 4 +
- } +
+ }. +
+ "Planning Time": 0.114 +
} +
]
(1 row)
@@ -328,7 +331,8 @@ EXPLAIN SELECT * FROM foo WHERE i = 4;
--------------------------------------------------------------
Index Scan using fi on foo (cost=0.00..5.98 rows=1 width=4)
Index Cond: (i = 4)
-(2 rows)
+ Planning time: 0.073 ms
+(3 rows)
</programlisting>
</para>
@@ -348,7 +352,8 @@ EXPLAIN (FORMAT YAML) SELECT * FROM foo WHERE i='4';
Total Cost: 5.98 +
Plan Rows: 1 +
Plan Width: 4 +
- Index Cond: "(i = 4)"
+ Index Cond: "(i = 4)" +
+ Planning Time: 0.073
(1 row)
</programlisting>
@@ -380,6 +385,7 @@ EXPLAIN SELECT sum(i) FROM foo WHERE i &lt; 10;
Aggregate (cost=23.93..23.93 rows=1 width=4)
-&gt; Index Scan using fi on foo (cost=0.00..23.92 rows=6 width=4)
Index Cond: (i &lt; 10)
+ Planning time: 0.088 ms
(3 rows)
</programlisting>
</para>
@@ -401,6 +407,7 @@ EXPLAIN ANALYZE EXECUTE query(100, 200);
Group Key: foo
-&gt; Index Scan using test_pkey on test (cost=0.29..9.29 rows=50 width=8) (actual time=0.039..0.091 rows=99 loops=1)
Index Cond: ((id &gt; $1) AND (id &lt; $2))
+ Planning time: 0.197 ms
Total runtime: 0.225 ms
(5 rows)
</programlisting>