From: David Fetter Date: Tue, 14 May 2019 22:50:12 -0700 Subject: [PATCH v4 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..63a3faede8 100644 --- a/doc/src/sgml/ref/explain.sgml +++ b/doc/src/sgml/ref/explain.sgml @@ -32,11 +32,11 @@ PostgreSQL documentation EXPLAIN [ ( option [, ...] ) ] statement -EXPLAIN [ ANALYZE ] [ VERBOSE ] statement +EXPLAIN [ EXEC ] [ VERBOSE ] statement where option can be one of: - ANALYZE [ boolean ] + EXEC [ boolean ] VERBOSE [ boolean ] COSTS [ boolean ] SETTINGS [ boolean ] @@ -76,36 +76,37 @@ 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. This is useful for seeing whether the planner's estimates - are close to reality. + are close to reality. For historical reasons, ANALYZE and ANALYSE can be + used instead of EXEC. 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; - Only the ANALYZE and VERBOSE options + Only the EXEC and VERBOSE options can be specified, and only in that order, without surrounding the option list in parentheses. Prior to PostgreSQL 9.0, the unparenthesized syntax was the only one supported. It is expected that @@ -118,7 +119,7 @@ ROLLBACK; - ANALYZE + EXEC Carry out the command and show actual run times and other statistics. @@ -159,7 +160,7 @@ ROLLBACK; Include information on configuration parameters. Specifically, include options affecting query planning with value different from the built-in - default value. This parameter defaults to FALSE. + default value. This parameter defaults to TRUE. @@ -186,8 +187,8 @@ 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 - FALSE. + used when EXEC is also enabled. It defaults to + TRUE. @@ -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,9 +216,9 @@ 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 + EXPLAIN EXEC includes the time required to fetch the plan from the cache and the time required for re-planning, if necessary. @@ -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-- --Ayym4vmyMU9P4uDb Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v4-0003-psql-support.patch"