From: David Fetter Date: Sat, 18 May 2019 11:07:14 -0700 Subject: [PATCH v5 2/8] Documentation To: hackers MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.21.0" This is a multi-part message in MIME format. --------------2.21.0 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit diff --git a/doc/src/sgml/ref/explain.sgml b/doc/src/sgml/ref/explain.sgml index 385d10411f..d79bddb68e 100644 --- a/doc/src/sgml/ref/explain.sgml +++ b/doc/src/sgml/ref/explain.sgml @@ -32,11 +32,12 @@ PostgreSQL documentation EXPLAIN [ ( option [, ...] ) ] statement -EXPLAIN [ ANALYZE ] [ VERBOSE ] statement +Legacy syntax: +EXPLAIN [ { ANALYZE | ANALYSE } ] [ VERBOSE ] statement where option can be one of: - ANALYZE [ boolean ] + EXEC [ boolean ] VERBOSE [ boolean ] COSTS [ boolean ] SETTINGS [ boolean ] @@ -76,7 +77,7 @@ EXPLAIN [ ANALYZE ] [ VERBOSE ] statement - The ANALYZE option causes the statement to be actually + The EXEC option causes the statement to be actually executed, not only planned. Then actual run time statistics are added to the display, including the total elapsed time expended within each plan node (in milliseconds) and the total number of rows it actually returned. @@ -87,18 +88,18 @@ EXPLAIN [ ANALYZE ] [ VERBOSE ] statement Keep in mind that the statement is actually executed when - the ANALYZE option is used. Although + the EXEC option is used. Although EXPLAIN will discard any output that a SELECT would return, other side effects of the statement will happen as usual. If you wish to use - EXPLAIN ANALYZE on an + EXPLAIN (EXEC) on an INSERT, UPDATE, DELETE, CREATE TABLE AS, or EXECUTE statement without letting the command affect your data, use this approach: BEGIN; -EXPLAIN ANALYZE ...; +EXPLAIN (EXEC) ...; ROLLBACK; @@ -118,7 +119,7 @@ ROLLBACK; - ANALYZE + EXEC Carry out the command and show actual run times and other statistics. @@ -186,7 +187,7 @@ ROLLBACK; The number of blocks shown for an upper-level node includes those used by all its child nodes. In text format, only non-zero values are printed. This parameter may only be - used when ANALYZE is also enabled. It defaults to + used when EXEC is also enabled. It defaults to FALSE. @@ -203,7 +204,7 @@ ROLLBACK; not exact times, are needed. Run time of the entire statement is always measured, even when node-level timing is turned off with this option. - This parameter may only be used when ANALYZE is also + This parameter may only be used when EXEC is also enabled. It defaults to TRUE. @@ -215,7 +216,7 @@ ROLLBACK; Include summary information (e.g., totaled timing information) after the query plan. Summary information is included by default when - ANALYZE is used but otherwise is not included by + EXEC is used but otherwise is not included by default, but can be enabled using this option. Planning time in EXPLAIN EXECUTE includes the time required to fetch the plan from the cache and the time required for re-planning, if @@ -295,8 +296,8 @@ ROLLBACK; In order to measure the run-time cost of each node in the execution plan, the current implementation of EXPLAIN - ANALYZE adds profiling overhead to query execution. - As a result, running EXPLAIN ANALYZE + (EXEC) adds profiling overhead to query execution. + As a result, running EXPLAIN (EXEC) on a query can sometimes take significantly longer than executing the query normally. The amount of overhead depends on the nature of the query, as well as the platform being used. The worst case occurs @@ -423,7 +424,7 @@ PREPARE query(int, int) AS SELECT sum(bar) FROM test WHERE id > $1 AND id < $2 GROUP BY foo; -EXPLAIN ANALYZE EXECUTE query(100, 200); +EXPLAIN (EXEC) EXECUTE query(100, 200); QUERY PLAN ------------------------------------------------------------------------------------------------------------------------ --------------2.21.0-- --PhxIMoEr374zxJm2 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v5-0003-psql-support.patch"