mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
Complete merge of all old man page information.
ecpg reference page still needs formatting.
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
<!--
|
||||
$Header: /cvsroot/pgsql/doc/src/sgml/ref/explain.sgml,v 1.8 1999/07/22 15:09:12 thomas Exp $
|
||||
Postgres documentation
|
||||
-->
|
||||
|
||||
<refentry id="SQL-EXPLAIN">
|
||||
<refmeta>
|
||||
<refentrytitle>
|
||||
<refentrytitle id="SQL-EXPLAIN-TITLE">
|
||||
EXPLAIN
|
||||
</refentrytitle>
|
||||
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
||||
@@ -16,7 +21,7 @@
|
||||
|
||||
<refsynopsisdiv>
|
||||
<refsynopsisdivinfo>
|
||||
<date>1998-09-01</date>
|
||||
<date>1999-07-20</date>
|
||||
</refsynopsisdivinfo>
|
||||
<synopsis>
|
||||
EXPLAIN [ VERBOSE ] <replaceable class="PARAMETER">query</replaceable>
|
||||
@@ -95,6 +100,7 @@ EXPLAIN
|
||||
<title>
|
||||
Description
|
||||
</title>
|
||||
|
||||
<para>
|
||||
This command outputs details about the supplied query.
|
||||
The default output is the computed query cost.
|
||||
@@ -127,16 +133,54 @@ EXPLAIN
|
||||
<title>
|
||||
Usage
|
||||
</title>
|
||||
|
||||
<para>
|
||||
To show a query plan for a simple query:
|
||||
To show a query plan for a simple query on a table with a single
|
||||
<type>int4</type> column and 128 rows:
|
||||
|
||||
<programlisting>
|
||||
EXPLAIN select * from foo;
|
||||
EXPLAIN SELECT * FROM foo;
|
||||
<computeroutput>
|
||||
NOTICE: QUERY PLAN:
|
||||
|
||||
Seq Scan on foo (cost=0.00 rows=0 width=4)
|
||||
Seq Scan on foo (cost=5.22 rows=128 width=4)
|
||||
|
||||
EXPLAIN
|
||||
</computeroutput>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For the same table with an index to support an
|
||||
<firstterm>equijoin</firstterm> condition on the query,
|
||||
<command>EXPLAIN</command> will show a different plan:
|
||||
|
||||
<programlisting>
|
||||
EXPLAIN SELECT * FROM foo WHERE i = 4;
|
||||
<computeroutput>
|
||||
NOTICE: QUERY PLAN:
|
||||
|
||||
Index Scan using fi on foo (cost=2.05 rows=1 width=4)
|
||||
|
||||
EXPLAIN
|
||||
</computeroutput>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
And finally, for the same table with an index to support an
|
||||
<firstterm>equijoin</firstterm> condition on the query,
|
||||
<command>EXPLAIN</command> will show the following for a query
|
||||
using an aggregate function:
|
||||
|
||||
<programlisting>
|
||||
EXPLAIN SELECT sum(i) FROM foo WHERE i = 4;
|
||||
<computeroutput>
|
||||
NOTICE: QUERY PLAN:
|
||||
|
||||
Aggregate (cost=2.05 rows=1 width=4)
|
||||
-> Index Scan using fi on foo (cost=2.05 rows=1 width=4)
|
||||
</computeroutput>
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
@@ -145,8 +189,6 @@ EXPLAIN
|
||||
<title>
|
||||
Compatibility
|
||||
</title>
|
||||
<para>
|
||||
</para>
|
||||
|
||||
<refsect2 id="R2-SQL-EXPLAIN-4">
|
||||
<refsect2info>
|
||||
|
Reference in New Issue
Block a user