Commit f72a342f authored by Tom Lane's avatar Tom Lane

Copy-editing for recent documentation changes relevant to WAL,

full_page_writes, etc.
parent 6d6c3722
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.71 2005/10/15 01:15:33 alvherre Exp $ $PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.72 2005/10/22 21:56:07 tgl Exp $
--> -->
<chapter id="backup"> <chapter id="backup">
<title>Backup and Restore</title> <title>Backup and Restore</title>
...@@ -1148,21 +1148,20 @@ restore_command = 'copy /mnt/server/archivedir/%f "%p"' # Windows ...@@ -1148,21 +1148,20 @@ restore_command = 'copy /mnt/server/archivedir/%f "%p"' # Windows
<para> <para>
It should also be noted that the default <acronym>WAL</acronym> It should also be noted that the default <acronym>WAL</acronym>
format is fairly bulky since it includes many disk page snapshots. The pages format is fairly bulky since it includes many disk page snapshots.
are partially compressed, using the simple expedient of removing the These page snapshots are designed to support crash recovery,
empty space (if any) within each block. You can significantly reduce since we may need to fix partially-written disk pages. Depending
on your system hardware and software, the risk of partial writes may
be small enough to ignore, in which case you can significantly reduce
the total volume of archived logs by turning off page snapshots the total volume of archived logs by turning off page snapshots
using the <xref linkend="guc-full-page-writes"> parameter, using the <xref linkend="guc-full-page-writes"> parameter.
though you should read the notes and warnings in (Read the notes and warnings in
<xref linkend="reliability"> before you do so. <xref linkend="reliability"> before you do so.)
These page snapshots are designed to allow crash recovery, Turning off page snapshots does not prevent use of the logs for PITR
since we may need to fix partially-written disk pages. It is not operations.
necessary to store these page copies for PITR operations, however.
If you turn off <xref linkend="guc-full-page-writes">, your PITR
backup and recovery operations will continue to work successfully.
An area for future development is to compress archived WAL data by An area for future development is to compress archived WAL data by
removing unnecessary page copies when <xref linkend="guc-full-page-writes"> removing unnecessary page copies even when <varname>full_page_writes</>
is turned on. In the meantime, administrators is on. In the meantime, administrators
may wish to reduce the number of page snapshots included in WAL by may wish to reduce the number of page snapshots included in WAL by
increasing the checkpoint interval parameters as much as feasible. increasing the checkpoint interval parameters as much as feasible.
</para> </para>
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.31 2005/10/15 20:12:32 neilc Exp $ $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.32 2005/10/22 21:56:07 tgl Exp $
--> -->
<chapter Id="runtime-config"> <chapter Id="runtime-config">
<title>Run-time Configuration</title> <title>Run-time Configuration</title>
...@@ -1251,14 +1251,15 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1251,14 +1251,15 @@ SET ENABLE_SEQSCAN TO OFF;
<listitem> <listitem>
<para> <para>
If this option is on, the <productname>PostgreSQL</> server If this option is on, the <productname>PostgreSQL</> server
will use the <function>fsync()</> system call in several places will try to make sure that updates are physically written to
to make sure that updates are physically written to disk. This disk, by issuing <function>fsync()</> system calls or various
insures that a database cluster will recover to a equivalent methods (see <xref linkend="guc-wal-sync-method">).
This ensures that the database cluster can recover to a
consistent state after an operating system or hardware crash. consistent state after an operating system or hardware crash.
</para> </para>
<para> <para>
However, using <function>fsync()</function> results in a However, using <varname>fsync</varname> results in a
performance penalty: when a transaction is committed, performance penalty: when a transaction is committed,
<productname>PostgreSQL</productname> must wait for the <productname>PostgreSQL</productname> must wait for the
operating system to flush the write-ahead log to disk. When operating system to flush the write-ahead log to disk. When
...@@ -1268,7 +1269,7 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1268,7 +1269,7 @@ SET ENABLE_SEQSCAN TO OFF;
However, if the system crashes, the results of the last few However, if the system crashes, the results of the last few
committed transactions may be lost in part or whole. In the committed transactions may be lost in part or whole. In the
worst case, unrecoverable data corruption may occur. worst case, unrecoverable data corruption may occur.
(Crashes of the database server itself are <emphasis>not</> (Crashes of the database software itself are <emphasis>not</>
a risk factor here. Only an operating-system-level crash a risk factor here. Only an operating-system-level crash
creates a risk of corruption.) creates a risk of corruption.)
</para> </para>
...@@ -1277,8 +1278,8 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1277,8 +1278,8 @@ SET ENABLE_SEQSCAN TO OFF;
Due to the risks involved, there is no universally correct Due to the risks involved, there is no universally correct
setting for <varname>fsync</varname>. Some administrators setting for <varname>fsync</varname>. Some administrators
always disable <varname>fsync</varname>, while others only always disable <varname>fsync</varname>, while others only
turn it off for bulk loads, where there is a clear restart turn it off during initial bulk data loads, where there is a clear
point if something goes wrong, whereas some administrators restart point if something goes wrong. Others
always leave <varname>fsync</varname> enabled. The default is always leave <varname>fsync</varname> enabled. The default is
to enable <varname>fsync</varname>, for maximum reliability. to enable <varname>fsync</varname>, for maximum reliability.
If you trust your operating system, your hardware, and your If you trust your operating system, your hardware, and your
...@@ -1288,9 +1289,9 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1288,9 +1289,9 @@ SET ENABLE_SEQSCAN TO OFF;
<para> <para>
This option can only be set at server start or in the This option can only be set at server start or in the
<filename>postgresql.conf</filename> file. If this option <filename>postgresql.conf</filename> file. If you turn
is <literal>off</>, consider also turning off this option off, also consider turning off
<varname>guc-full-page-writes</>. <xref linkend="guc-full-page-writes">.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1302,8 +1303,10 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1302,8 +1303,10 @@ SET ENABLE_SEQSCAN TO OFF;
</indexterm> </indexterm>
<listitem> <listitem>
<para> <para>
Method used for forcing WAL updates out to disk. Possible Method used for forcing WAL updates out to disk.
values are: If <varname>fsync</varname> is off then this setting is irrelevant,
since updates will not be forced out at all.
Possible values are:
</para> </para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
...@@ -1313,17 +1316,17 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1313,17 +1316,17 @@ SET ENABLE_SEQSCAN TO OFF;
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<literal>fdatasync</> (call <function>fdatasync()</> at each commit), <literal>fdatasync</> (call <function>fdatasync()</> at each commit)
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<literal>fsync</> (call <function>fsync()</> at each commit) <literal>fsync_writethrough</> (call <function>fsync()</> at each commit, forcing write-through of any disk write cache)
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para> <para>
<literal>fsync_writethrough</> (force write-through of any disk write cache) <literal>fsync</> (call <function>fsync()</> at each commit)
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
...@@ -1334,8 +1337,7 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1334,8 +1337,7 @@ SET ENABLE_SEQSCAN TO OFF;
</itemizedlist> </itemizedlist>
<para> <para>
Not all of these choices are available on all platforms. Not all of these choices are available on all platforms.
The top-most supported option is used as the default. The default is the first method in the above list that is supported.
If <varname>fsync</varname> is off then this setting is irrelevant.
This option can only be set at server start or in the This option can only be set at server start or in the
<filename>postgresql.conf</filename> file. <filename>postgresql.conf</filename> file.
</para> </para>
...@@ -1349,21 +1351,37 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1349,21 +1351,37 @@ SET ENABLE_SEQSCAN TO OFF;
<term><varname>full_page_writes</varname> (<type>boolean</type>)</term> <term><varname>full_page_writes</varname> (<type>boolean</type>)</term>
<listitem> <listitem>
<para> <para>
A page write in process during an operating system crash might When this option is on, the <productname>PostgreSQL</> server
be only partially written to disk, leading to an on-disk page writes the entire content of each disk page to WAL during the
that contains a mix of old and new data. During recovery, the first modification of that page after a checkpoint.
row changes stored in WAL are not enough to completely restore This is needed because
the page. a page write that is in process during an operating system crash might
be only partially completed, leading to an on-disk page
that contains a mix of old and new data. The row-level change data
normally stored in WAL will not be enough to completely restore
such a page during post-crash recovery. Storing the full page image
guarantees that the page can be correctly restored, but at a price
in increasing the amount of data that must be written to WAL.
(Because WAL replay always starts from a checkpoint, it is sufficient
to do this during the first change of each page after a checkpoint.
Therefore, one way to reduce the cost of full-page writes is to
increase the checkpoint interval parameters.)
</para> </para>
<para> <para>
When this option is on, the <productname>PostgreSQL</> server Turning this option off speeds normal operation, but
writes full pages to WAL when they are first modified after a might lead to a corrupt database after an operating system crash
checkpoint so crash recovery is possible. Turning this option off or power failure. The risks are similar to turning off
might lead to a corrupt system after an operating system crash <varname>fsync</>, though smaller. It may be safe to turn off
or power failure because uncorrected partial pages might contain this option if you have hardware (such as a battery-backed disk
inconsistent or corrupt data. The risks are less but similar to controller) or filesystem software (e.g., Reiser4) that reduces
<varname>fsync</>. the risk of partial page writes to an acceptably low level.
</para>
<para>
Turning off this option does not affect use of
WAL archiving for point-in-time recovery (PITR)
(see <xref linkend="backup-online">).
</para> </para>
<para> <para>
...@@ -1384,7 +1402,7 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1384,7 +1402,7 @@ SET ENABLE_SEQSCAN TO OFF;
Number of disk-page buffers allocated in shared memory for WAL data. Number of disk-page buffers allocated in shared memory for WAL data.
The default is 8. The setting need only be large enough to hold The default is 8. The setting need only be large enough to hold
the amount of WAL data generated by one typical transaction, since the amount of WAL data generated by one typical transaction, since
the data is flushed to disk at every transaction commit. the data is written out to disk at every transaction commit.
This option can only be set at server start. This option can only be set at server start.
</para> </para>
...@@ -1481,8 +1499,9 @@ SET ENABLE_SEQSCAN TO OFF; ...@@ -1481,8 +1499,9 @@ SET ENABLE_SEQSCAN TO OFF;
<para> <para>
Write a message to the server log if checkpoints caused by Write a message to the server log if checkpoints caused by
the filling of checkpoint segment files happen closer together the filling of checkpoint segment files happen closer together
than this many seconds. The default is 30 seconds. than this many seconds (which suggests that
Zero turns off the warning. <varname>checkpoint_segments</> ought to be raised). The default is
30 seconds. Zero disables the warning.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment