Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6f1932c

Browse files
committed
Reword fsync and full_page_writes docs to be clearer about when to turn
them off. Josh Berkus, with slight wording changes by me.
1 parent e0b581a commit 6f1932c

File tree

1 file changed

+19
-32
lines changed

1 file changed

+19
-32
lines changed

doc/src/sgml/config.sgml

Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.279 2010/05/26 23:49:18 tgl Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.280 2010/05/31 15:50:48 momjian Exp $ -->
22

33
<chapter Id="runtime-config">
44
<title>Server Configuration</title>
@@ -1413,34 +1413,23 @@ SET ENABLE_SEQSCAN TO OFF;
14131413
</para>
14141414

14151415
<para>
1416-
However, using <varname>fsync</varname> results in a
1417-
performance penalty: when a transaction is committed,
1418-
<productname>PostgreSQL</productname> must wait for the
1419-
operating system to flush the write-ahead log to disk. When
1420-
<varname>fsync</varname> is disabled, the operating system is
1421-
allowed to do its best in buffering, ordering, and delaying
1422-
writes. This can result in significantly improved performance.
1423-
However, if the system crashes, the results of the last few
1424-
committed transactions might be completely lost, or worse,
1425-
might appear partially committed, leaving the database in an
1426-
inconsistent state. In the
1427-
worst case, unrecoverable data corruption might occur.
1428-
(Crashes of the database software itself are <emphasis>not</>
1429-
a risk factor here. Only an operating-system-level crash
1430-
creates a risk of corruption.)
1416+
While turning off <varname>fsync</varname> is often a performance
1417+
benefit, this can result in unrecoverable data corruption in
1418+
the event of an unexpected system shutdown or crash. Thus it
1419+
is only advisable to turn off <varname>fsync</varname> if
1420+
you can easily recreate your entire database from external
1421+
data.
14311422
</para>
14321423

14331424
<para>
1434-
Due to the risks involved, there is no universally correct
1435-
setting for <varname>fsync</varname>. Some administrators
1436-
always disable <varname>fsync</varname>, while others only
1437-
turn it off during initial bulk data loads, where there is a clear
1438-
restart point if something goes wrong. Others
1439-
always leave <varname>fsync</varname> enabled. The default is
1440-
to enable <varname>fsync</varname>, for maximum reliability.
1441-
If you trust your operating system, your hardware, and your
1442-
utility company (or your battery backup), you can consider
1443-
disabling <varname>fsync</varname>.
1425+
Examples of safe circumstances for turning off
1426+
<varname>fsync</varname> include the initial loading a new
1427+
database cluster from a backup file, using a database cluster
1428+
for processing statistics on an hourly basis which is then
1429+
recreated, or for a reporting read-only database clone which
1430+
gets recreated frequently and is not used for failover. High
1431+
quality hardware alone is not a sufficient justification for
1432+
turning off <varname>fsync</varname>.
14441433
</para>
14451434

14461435
<para>
@@ -1572,12 +1561,10 @@ SET ENABLE_SEQSCAN TO OFF;
15721561

15731562
<para>
15741563
Turning this parameter off speeds normal operation, but
1575-
might lead to a corrupt database after an operating system crash
1576-
or power failure. The risks are similar to turning off
1577-
<varname>fsync</>, though smaller. It might be safe to turn off
1578-
this parameter if you have hardware (such as a battery-backed disk
1579-
controller) or file-system software that reduces
1580-
the risk of partial page writes to an acceptably low level (e.g., ZFS).
1564+
might lead to either unrecoverable data corruption, or silent
1565+
data corruption, after a system failure. The risks are similar to turning off
1566+
<varname>fsync</varname>, though smaller, and it should be turned off
1567+
only based on the same circumstances recommended for that parameter.
15811568
</para>
15821569

15831570
<para>

0 commit comments

Comments
 (0)