Home Explore Blog CI



postgresql

88th chunk of `doc/src/sgml/config.sgml`
6666aa395ed76d963e37db67afefb5e7ff76f6862f5c91100000000100000fa2
 there are other methods available. The
        default is <literal>on</literal>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-enable-sort" xreflabel="enable_sort">
      <term><varname>enable_sort</varname> (<type>boolean</type>)
      <indexterm>
       <primary><varname>enable_sort</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Enables or disables the query planner's use of explicit sort
        steps. It is impossible to suppress explicit sorts entirely,
        but turning this variable off discourages the planner from
        using one if there are other methods available. The default
        is <literal>on</literal>.
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-enable-tidscan" xreflabel="enable_tidscan">
      <term><varname>enable_tidscan</varname> (<type>boolean</type>)
      <indexterm>
       <primary><varname>enable_tidscan</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Enables or disables the query planner's use of <acronym>TID</acronym>
        scan plan types. The default is <literal>on</literal>.
       </para>
      </listitem>
     </varlistentry>

     </variablelist>
     </sect2>
     <sect2 id="runtime-config-query-constants">
     <title>Planner Cost Constants</title>

    <para>
     The <firstterm>cost</firstterm> variables described in this section are measured
     on an arbitrary scale.  Only their relative values matter, hence
     scaling them all up or down by the same factor will result in no change
     in the planner's choices.  By default, these cost variables are based on
     the cost of sequential page fetches; that is,
     <varname>seq_page_cost</varname> is conventionally set to <literal>1.0</literal>
     and the other cost variables are set with reference to that.  But
     you can use a different scale if you prefer, such as actual execution
     times in milliseconds on a particular machine.
    </para>

   <note>
    <para>
     Unfortunately, there is no well-defined method for determining ideal
     values for the cost variables.  They are best treated as averages over
     the entire mix of queries that a particular installation will receive.  This
     means that changing them on the basis of just a few experiments is very
     risky.
    </para>
   </note>

     <variablelist>

     <varlistentry id="guc-seq-page-cost" xreflabel="seq_page_cost">
      <term><varname>seq_page_cost</varname> (<type>floating point</type>)
      <indexterm>
       <primary><varname>seq_page_cost</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Sets the planner's estimate of the cost of a disk page fetch
        that is part of a series of sequential fetches.  The default is 1.0.
        This value can be overridden for tables and indexes in a particular
        tablespace by setting the tablespace parameter of the same name
        (see <xref linkend="sql-altertablespace"/>).
       </para>
      </listitem>
     </varlistentry>

     <varlistentry id="guc-random-page-cost" xreflabel="random_page_cost">
      <term><varname>random_page_cost</varname> (<type>floating point</type>)
      <indexterm>
       <primary><varname>random_page_cost</varname> configuration parameter</primary>
      </indexterm>
      </term>
      <listitem>
       <para>
        Sets the planner's estimate of the cost of a
        non-sequentially-fetched disk page.  The default is 4.0.
        This value can be overridden for tables and indexes in a particular
        tablespace by setting the tablespace parameter of the same name
        (see <xref linkend="sql-altertablespace"/>).
       </para>

       <para>
        Reducing this value relative to <varname>seq_page_cost</varname>
        will cause the system to prefer index scans; raising it will

Title: Query Planning Configuration: TID Scan, Planner Cost Constants, and Page Fetch Costs
Summary
This section details query planner configurations, focusing on enabling/disabling TID scans (`enable_tidscan`, defaults to on) and planner cost constants. It explains that cost variables are relative and based on sequential page fetch costs. It covers `seq_page_cost` (cost of sequential disk page fetches, default 1.0) and `random_page_cost` (cost of non-sequential disk page fetches, default 4.0), which can be overridden at the tablespace level.