explain.sgml
上传用户:blenddy
上传日期:2007-01-07
资源大小:6495k
文件大小:4k
源码类别:

数据库系统

开发平台:

Unix_Linux

  1. <refentry id="SQL-EXPLAIN">
  2.  <refmeta>
  3.   <refentrytitle>
  4.    EXPLAIN
  5.   </refentrytitle>
  6.   <refmiscinfo>SQL - Language Statements</refmiscinfo>
  7.  </refmeta>
  8.  <refnamediv>
  9.   <refname>
  10.    EXPLAIN
  11.   </refname>
  12.   <refpurpose>
  13.    Shows statement execution details
  14.   </refpurpose>
  15.  </refnamediv>
  16.  <refsynopsisdiv>
  17.   <refsynopsisdivinfo>
  18.    <date>1998-09-01</date>
  19.   </refsynopsisdivinfo>
  20.   <synopsis>
  21. EXPLAIN [ VERBOSE ] <replaceable class="PARAMETER">query</replaceable>        
  22.   </synopsis>
  23.   <refsect2 id="R2-SQL-EXPLAIN-1">
  24.    <refsect2info>
  25.     <date>1998-09-01</date>
  26.    </refsect2info>
  27.    <title>
  28.     Inputs
  29.    </title>
  30.    <para>
  31.     <variablelist>
  32.      <varlistentry>
  33.       <term>VERBOSE</term>
  34.       <listitem>
  35.        <para>
  36. Flag to show detailed query plan.
  37.        </para>
  38.       </listitem>
  39.      </varlistentry>
  40.      <varlistentry>
  41.       <term><replaceable class="PARAMETER">query</replaceable></term>
  42.       <listitem>
  43.        <para>
  44. Any <replaceable class="PARAMETER">query</replaceable>.
  45.        </para>
  46.       </listitem>
  47.      </varlistentry>
  48.     </variablelist>
  49.    </para>
  50.   </refsect2>
  51.   <refsect2 id="R2-SQL-EXPLAIN-2">
  52.    <refsect2info>
  53.     <date>1998-04-15</date>
  54.    </refsect2info>
  55.    <title>
  56.     Outputs
  57.    </title>
  58.    <para>
  59.     <variablelist>
  60.      <varlistentry>
  61.       <term><computeroutput>
  62. NOTICE:  QUERY PLAN:
  63. <replaceable>plan</replaceable>
  64.       </computeroutput></term>
  65.       <listitem>
  66.        <para>
  67. Explicit query plan from the <productname>Postgres</productname> backend.
  68.        </para>
  69.       </listitem>
  70.      </varlistentry>
  71.      <varlistentry>
  72.       <term><computeroutput>
  73. EXPLAIN
  74.        </computeroutput></term>
  75.       <listitem>
  76.        <para>
  77. Flag sent after query plan is shown.
  78.        </para>
  79.       </listitem>
  80.      </varlistentry>
  81.     </variablelist>
  82.    </para>
  83.   </refsect2>
  84.  </refsynopsisdiv>
  85.  <refsect1 id="R1-SQL-EXPLAIN-1">
  86.   <refsect1info>
  87.    <date>1998-04-15</date>
  88.   </refsect1info>
  89.   <title>
  90.    Description
  91.   </title>
  92.   <para>
  93.    This command outputs details about the supplied query.
  94.    The default output is the computed query cost. 
  95.    The cost value is only meaningful to the optimizer in comparing
  96.    various query plans.
  97.    VERBOSE displays the full query plan and cost to your screen,
  98.    and pretty-prints the plan to the postmaster log file.   
  99.   </para>
  100.   <refsect2 id="R2-SQL-EXPLAIN-3">
  101.    <refsect2info>
  102.     <date>1998-04-15</date>
  103.    </refsect2info>
  104.    <title>
  105.     Notes
  106.    </title>
  107.    <para>
  108.     There is only sparse documentation on the optimizer's use of cost
  109.     information in <productname>Postgres</productname>.
  110.     General information on cost estimation for query optimization
  111.     can be found in database textbooks.
  112.     Refer to the <citetitle>Programmer's Guide</citetitle>
  113.     in the chapters on indexes and the genetic query optimizer for
  114.     more information.
  115.    </para>
  116.   </refsect2>
  117.  </refsect1>
  118.  <refsect1 id="R1-SQL-EXPLAIN-2">
  119.   <title>
  120.    Usage
  121.   </title>
  122.   <para>
  123.    To show a query plan for a simple query:
  124.    <programlisting>
  125. EXPLAIN select * from foo;
  126. NOTICE:  QUERY PLAN:
  127. Seq Scan on foo  (cost=0.00 rows=0 width=4)
  128. EXPLAIN
  129.    </programlisting>
  130.   </para>
  131.  </refsect1>
  132.  <refsect1 id="R1-SQL-EXPLAIN-3">
  133.   <title>
  134.    Compatibility
  135.   </title>
  136.   <para>
  137.   </para>
  138.   <refsect2 id="R2-SQL-EXPLAIN-4">
  139.    <refsect2info>
  140.     <date>1998-09-01</date>
  141.    </refsect2info>
  142.    <title>
  143.     SQL92
  144.    </title>
  145.    <para>
  146.     There is no <command>EXPLAIN</command> statement defined in SQL92.
  147.    </para>
  148.   </refsect2>
  149.  </refsect1>
  150. </refentry>
  151. <!-- Keep this comment at the end of the file
  152. Local variables:
  153. mode: sgml
  154. sgml-omittag:nil
  155. sgml-shorttag:t
  156. sgml-minimize-attributes:nil
  157. sgml-always-quote-attributes:t
  158. sgml-indent-step:1
  159. sgml-indent-data:t
  160. sgml-parent-document:nil
  161. sgml-default-dtd-file:"../reference.ced"
  162. sgml-exposed-tags:nil
  163. sgml-local-catalogs:"/usr/lib/sgml/catalog"
  164. sgml-local-ecat-files:nil
  165. End:
  166. -->