1
- <!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.59 2006/05/21 20:10:42 tgl Exp $ -->
1
+ <!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.60 2006/06/05 02:49:58 tgl Exp $ -->
2
2
3
3
<chapter Id="runtime-config">
4
4
<title>Server Configuration</title>
@@ -1739,40 +1739,39 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows
1739
1739
Planner Cost Constants
1740
1740
</title>
1741
1741
1742
+ <para>
1743
+ The <firstterm>cost</> variables described in this section are measured
1744
+ on an arbitrary scale. Only their relative values matter, hence
1745
+ scaling them all up or down by the same factor will result in no change
1746
+ in the planner's choices. Traditionally, these variables have been
1747
+ referenced to sequential page fetches as the unit of cost; that is,
1748
+ <varname>seq_page_cost</> is conventionally set to <literal>1.0</>
1749
+ and the other cost variables are set with reference to that. But
1750
+ you can use a different scale if you prefer, such as actual execution
1751
+ times in milliseconds on a particular machine.
1752
+ </para>
1753
+
1742
1754
<note>
1743
1755
<para>
1744
- Unfortunately, there is no well-defined method for determining
1745
- ideal values for the family of <quote>cost</quote> variables that
1746
- appear below. You are encouraged to experiment and share
1747
- your findings.
1756
+ Unfortunately, there is no well-defined method for determining ideal
1757
+ values for the cost variables. They are best treated as averages over
1758
+ the entire mix of queries that a particular installation will get. This
1759
+ means that changing them on the basis of just a few experiments is very
1760
+ risky.
1748
1761
</para>
1749
1762
</note>
1750
1763
1751
1764
<variablelist>
1752
-
1753
- <varlistentry id="guc-effective-cache-size " xreflabel="effective_cache_size ">
1754
- <term><varname>effective_cache_size </varname> (<type>floating point</type>)</term>
1765
+
1766
+ <varlistentry id="guc-seq-page-cost " xreflabel="seq_page_cost ">
1767
+ <term><varname>seq_page_cost </varname> (<type>floating point</type>)</term>
1755
1768
<indexterm>
1756
- <primary><varname>effective_cache_size </> configuration parameter</primary>
1769
+ <primary><varname>seq_page_cost </> configuration parameter</primary>
1757
1770
</indexterm>
1758
1771
<listitem>
1759
1772
<para>
1760
- Sets the planner's assumption about the effective size of the
1761
- disk cache that is available to a single index scan. This is
1762
- factored into estimates of the cost of using an index; a
1763
- higher value makes it more likely index scans will be used, a
1764
- lower value makes it more likely sequential scans will be
1765
- used. When setting this parameter you should consider both
1766
- <productname>PostgreSQL</productname>'s shared buffers and the
1767
- portion of the kernel's disk cache that will be used for
1768
- <productname>PostgreSQL</productname> data files. Also, take
1769
- into account the expected number of concurrent queries using
1770
- different indexes, since they will have to share the available
1771
- space. This parameter has no effect on the size of shared
1772
- memory allocated by <productname>PostgreSQL</productname>, nor
1773
- does it reserve kernel disk cache; it is used only for
1774
- estimation purposes. The value is measured in disk pages,
1775
- which are normally 8192 bytes each. The default is 1000.
1773
+ Sets the planner's estimate of the cost of a disk page fetch
1774
+ that is part of a series of sequential fetches. The default is 1.0.
1776
1775
</para>
1777
1776
</listitem>
1778
1777
</varlistentry>
@@ -1785,12 +1784,27 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows
1785
1784
<listitem>
1786
1785
<para>
1787
1786
Sets the planner's estimate of the cost of a
1788
- nonsequentially fetched disk page. This is measured as a
1789
- multiple of the cost of a sequential page fetch. A higher
1790
- value makes it more likely a sequential scan will be used, a
1791
- lower value makes it more likely an index scan will be
1792
- used. The default is four.
1787
+ non-sequentially-fetched disk page. The default is 4.0.
1788
+ Reducing this value relative to <varname>seq_page_cost</>
1789
+ will cause the system to prefer index scans; raising it will
1790
+ make index scans look relatively more expensive. You can raise
1791
+ or lower both values together to change the importance of disk I/O
1792
+ costs relative to CPU costs, which are described by the following
1793
+ parameters.
1793
1794
</para>
1795
+
1796
+ <tip>
1797
+ <para>
1798
+ Although the system will let you set <varname>random_page_cost</> to
1799
+ less than <varname>seq_page_cost</>, it is not physically sensible
1800
+ to do so. However, setting them equal makes sense if the database
1801
+ is entirely cached in RAM, since in that case there is no penalty
1802
+ for touching pages out of sequence. Also, in a heavily-cached
1803
+ database you should lower both values relative to the CPU parameters,
1804
+ since the cost of fetching a page already in RAM is much smaller
1805
+ than it would normally be.
1806
+ </para>
1807
+ </tip>
1794
1808
</listitem>
1795
1809
</varlistentry>
1796
1810
@@ -1802,8 +1816,8 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows
1802
1816
<listitem>
1803
1817
<para>
1804
1818
Sets the planner's estimate of the cost of processing
1805
- each row during a query. This is measured as a fraction of
1806
- the cost of a sequential page fetch. The default is 0.01.
1819
+ each row during a query.
1820
+ The default is 0.01.
1807
1821
</para>
1808
1822
</listitem>
1809
1823
</varlistentry>
@@ -1816,9 +1830,8 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows
1816
1830
<listitem>
1817
1831
<para>
1818
1832
Sets the planner's estimate of the cost of processing
1819
- each index row during an index scan. This is measured as a
1820
- fraction of the cost of a sequential page fetch. The default
1821
- is 0.001.
1833
+ each index entry during an index scan.
1834
+ The default is 0.001.
1822
1835
</para>
1823
1836
</listitem>
1824
1837
</varlistentry>
@@ -1831,8 +1844,35 @@ archive_command = 'copy "%p" /mnt/server/archivedir/"%f"' # Windows
1831
1844
<listitem>
1832
1845
<para>
1833
1846
Sets the planner's estimate of the cost of processing each
1834
- operator in a <literal>WHERE</> clause. This is measured as a fraction of
1835
- the cost of a sequential page fetch. The default is 0.0025.
1847
+ operator or function executed during a query.
1848
+ The default is 0.0025.
1849
+ </para>
1850
+ </listitem>
1851
+ </varlistentry>
1852
+
1853
+ <varlistentry id="guc-effective-cache-size" xreflabel="effective_cache_size">
1854
+ <term><varname>effective_cache_size</varname> (<type>floating point</type>)</term>
1855
+ <indexterm>
1856
+ <primary><varname>effective_cache_size</> configuration parameter</primary>
1857
+ </indexterm>
1858
+ <listitem>
1859
+ <para>
1860
+ Sets the planner's assumption about the effective size of the
1861
+ disk cache that is available to a single index scan. This is
1862
+ factored into estimates of the cost of using an index; a
1863
+ higher value makes it more likely index scans will be used, a
1864
+ lower value makes it more likely sequential scans will be
1865
+ used. When setting this parameter you should consider both
1866
+ <productname>PostgreSQL</productname>'s shared buffers and the
1867
+ portion of the kernel's disk cache that will be used for
1868
+ <productname>PostgreSQL</productname> data files. Also, take
1869
+ into account the expected number of concurrent queries using
1870
+ different indexes, since they will have to share the available
1871
+ space. This parameter has no effect on the size of shared
1872
+ memory allocated by <productname>PostgreSQL</productname>, nor
1873
+ does it reserve kernel disk cache; it is used only for
1874
+ estimation purposes. The value is measured in disk pages,
1875
+ which are normally 8192 bytes each. The default is 1000.
1836
1876
</para>
1837
1877
</listitem>
1838
1878
</varlistentry>
0 commit comments