11<!--
2- $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.306 2005/03/02 19:58:54 tgl Exp $
2+ $PostgreSQL: pgsql/doc/src/sgml/runtime.sgml,v 1.307 2005/03/04 20:21:05 tgl Exp $
33-->
44
55<chapter Id="runtime">
@@ -1379,9 +1379,7 @@ SET ENABLE_SEQSCAN TO OFF;
13791379 Specifies the delay between activity rounds for the
13801380 background writer. In each round the writer issues writes
13811381 for some number of dirty buffers (controllable by the
1382- following parameters). The selected buffers will always be
1383- the least recently used ones among the currently dirty
1384- buffers. It then sleeps for <varname>bgwriter_delay</>
1382+ following parameters). It then sleeps for <varname>bgwriter_delay</>
13851383 milliseconds, and repeats. The default value is 200. Note
13861384 that on many systems, the effective resolution of sleep
13871385 delays is 10 milliseconds; setting <varname>bgwriter_delay</>
@@ -1393,46 +1391,97 @@ SET ENABLE_SEQSCAN TO OFF;
13931391 </listitem>
13941392 </varlistentry>
13951393
1396- <varlistentry id="guc-bgwriter-percent" xreflabel="bgwriter_percent ">
1397- <term><varname>bgwriter_percent </varname> (<type>integer </type>)</term>
1394+ <varlistentry id="guc-bgwriter-lru- percent" xreflabel="bgwriter_lru_percent ">
1395+ <term><varname>bgwriter_lru_percent </varname> (<type>floating point </type>)</term>
13981396 <indexterm>
1399- <primary><varname>bgwriter_percent </> configuration parameter</primary>
1397+ <primary><varname>bgwriter_lru_percent </> configuration parameter</primary>
14001398 </indexterm>
14011399 <listitem>
14021400 <para>
1403- In each round, no more than this percentage of the currently
1404- dirty buffers will be written (rounding up any fraction to
1405- the next whole number of buffers). The default value is
1406- 1. This option can only be set at server start or in the
1401+ To reduce the probability that server processes will need to issue
1402+ their own writes, the background writer tries to write buffers that
1403+ are likely to be recycled soon. In each round, it examines up to
1404+ <varname>bgwriter_lru_percent</> of the buffers that are nearest to
1405+ being recycled, and writes any that are dirty.
1406+ The default value is 1.0 (this is a percentage of the total number
1407+ of shared buffers).
1408+ This option can only be set at server start or in the
1409+ <filename>postgresql.conf</filename> file.
1410+ </para>
1411+ </listitem>
1412+ </varlistentry>
1413+
1414+ <varlistentry id="guc-bgwriter-lru-maxpages" xreflabel="bgwriter_lru_maxpages">
1415+ <term><varname>bgwriter_lru_maxpages</varname> (<type>integer</type>)</term>
1416+ <indexterm>
1417+ <primary><varname>bgwriter_lru_maxpages</> configuration parameter</primary>
1418+ </indexterm>
1419+ <listitem>
1420+ <para>
1421+ In each round, no more than this many buffers will be written
1422+ as a result of scanning soon-to-be-recycled buffers.
1423+ The default value is 5.
1424+ This option can only be set at server start or in the
1425+ <filename>postgresql.conf</filename> file.
1426+ </para>
1427+ </listitem>
1428+ </varlistentry>
1429+
1430+ <varlistentry id="guc-bgwriter-all-percent" xreflabel="bgwriter_all_percent">
1431+ <term><varname>bgwriter_all_percent</varname> (<type>floating point</type>)</term>
1432+ <indexterm>
1433+ <primary><varname>bgwriter_all_percent</> configuration parameter</primary>
1434+ </indexterm>
1435+ <listitem>
1436+ <para>
1437+ To reduce the amount of work that will be needed at checkpoint time,
1438+ the background writer also does a circular scan through the entire
1439+ buffer pool, writing buffers that are found to be dirty.
1440+ In each round, it examines up to
1441+ <varname>bgwriter_all_percent</> of the buffers for this purpose.
1442+ The default value is 0.333 (this is a percentage of the total number
1443+ of shared buffers). With the default <varname>bgwriter_delay</>
1444+ setting, this will allow the entire shared buffer pool to be scanned
1445+ about once per minute.
1446+ This option can only be set at server start or in the
14071447 <filename>postgresql.conf</filename> file.
14081448 </para>
14091449 </listitem>
14101450 </varlistentry>
14111451
1412- <varlistentry id="guc-bgwriter-maxpages" xreflabel="bgwriter_maxpages ">
1413- <term><varname>bgwriter_maxpages </varname> (<type>integer</type>)</term>
1452+ <varlistentry id="guc-bgwriter-all- maxpages" xreflabel="bgwriter_all_maxpages ">
1453+ <term><varname>bgwriter_all_maxpages </varname> (<type>integer</type>)</term>
14141454 <indexterm>
1415- <primary><varname>bgwriter_maxpages </> configuration parameter</primary>
1455+ <primary><varname>bgwriter_all_maxpages </> configuration parameter</primary>
14161456 </indexterm>
14171457 <listitem>
14181458 <para>
1419- In each round, no more than this many dirty buffers will be
1420- written. The default value is 100. This option can only be
1421- set at server start or in the
1459+ In each round, no more than this many buffers will be written
1460+ as a result of the scan of the entire buffer pool. (If this
1461+ limit is reached, the scan stops, and resumes at the next buffer
1462+ during the next round.)
1463+ The default value is 5.
1464+ This option can only be set at server start or in the
14221465 <filename>postgresql.conf</filename> file.
14231466 </para>
14241467 </listitem>
14251468 </varlistentry>
14261469 </variablelist>
14271470
14281471 <para>
1429- Smaller values of <varname>bgwriter_percent </varname> and
1430- <varname>bgwriter_maxpages </varname> reduce the extra I/O load
1472+ Smaller values of <varname>bgwriter_all_percent </varname> and
1473+ <varname>bgwriter_all_maxpages </varname> reduce the extra I/O load
14311474 caused by the background writer, but leave more work to be done
14321475 at checkpoint time. To reduce load spikes at checkpoints,
1433- increase the values. To disable background writing entirely,
1434- set <varname>bgwriter_percent</varname> and/or
1435- <varname>bgwriter_maxpages</varname> to zero.
1476+ increase these two values.
1477+ Similarly, smaller values of <varname>bgwriter_lru_percent</varname> and
1478+ <varname>bgwriter_lru_maxpages</varname> reduce the extra I/O load
1479+ caused by the background writer, but make it more likely that server
1480+ processes will have to issue writes for themselves, delaying interactive
1481+ queries.
1482+ To disable background writing entirely,
1483+ set both <varname>maxpages</varname> values and/or both
1484+ <varname>percent</varname> values to zero.
14361485 </para>
14371486 </sect3>
14381487
@@ -3866,20 +3915,6 @@ plruby.bar = true # generates error, unknown class name
38663915 </listitem>
38673916 </varlistentry>
38683917
3869- <varlistentry id="guc-debug-shared-buffers" xreflabel="debug_shared_buffers">
3870- <term><varname>debug_shared_buffers</varname> (<type>integer</type>)</term>
3871- <indexterm>
3872- <primary><varname>debug_shared_buffers</> configuration parameter</primary>
3873- </indexterm>
3874- <listitem>
3875- <para>
3876- Number of seconds between ARC reports.
3877- If set greater than zero, emit ARC statistics to the log every so many
3878- seconds. Zero (the default) disables reporting.
3879- </para>
3880- </listitem>
3881- </varlistentry>
3882-
38833918 <varlistentry id="guc-pre-auth-delay" xreflabel="pre_auth_delay">
38843919 <term><varname>pre_auth_delay</varname> (<type>integer</type>)</term>
38853920 <indexterm>