1
1
<!--
2
- $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.31 2005/10/15 20:12:32 neilc Exp $
2
+ $PostgreSQL: pgsql/doc/src/sgml/config.sgml,v 1.32 2005/10/22 21:56:07 tgl Exp $
3
3
-->
4
4
<chapter Id="runtime-config">
5
5
<title>Run-time Configuration</title>
@@ -1251,14 +1251,15 @@ SET ENABLE_SEQSCAN TO OFF;
1251
1251
<listitem>
1252
1252
<para>
1253
1253
If this option is on, the <productname>PostgreSQL</> server
1254
- will use the <function>fsync()</> system call in several places
1255
- to make sure that updates are physically written to disk. This
1256
- insures that a database cluster will recover to a
1254
+ will try to make sure that updates are physically written to
1255
+ disk, by issuing <function>fsync()</> system calls or various
1256
+ equivalent methods (see <xref linkend="guc-wal-sync-method">).
1257
+ This ensures that the database cluster can recover to a
1257
1258
consistent state after an operating system or hardware crash.
1258
1259
</para>
1259
1260
1260
1261
<para>
1261
- However, using <function >fsync()</function > results in a
1262
+ However, using <varname >fsync</varname > results in a
1262
1263
performance penalty: when a transaction is committed,
1263
1264
<productname>PostgreSQL</productname> must wait for the
1264
1265
operating system to flush the write-ahead log to disk. When
@@ -1268,7 +1269,7 @@ SET ENABLE_SEQSCAN TO OFF;
1268
1269
However, if the system crashes, the results of the last few
1269
1270
committed transactions may be lost in part or whole. In the
1270
1271
worst case, unrecoverable data corruption may occur.
1271
- (Crashes of the databaseserver itself are <emphasis>not</>
1272
+ (Crashes of the databasesoftware itself are <emphasis>not</>
1272
1273
a risk factor here. Only an operating-system-level crash
1273
1274
creates a risk of corruption.)
1274
1275
</para>
@@ -1277,8 +1278,8 @@ SET ENABLE_SEQSCAN TO OFF;
1277
1278
Due to the risks involved, there is no universally correct
1278
1279
setting for <varname>fsync</varname>. Some administrators
1279
1280
always disable <varname>fsync</varname>, while others only
1280
- turn it offfor bulk loads, where there is a clear restart
1281
- point if something goes wrong, whereas some administrators
1281
+ turn it offduring initial bulkdata loads, where there is a clear
1282
+ restart point if something goes wrong. Others
1282
1283
always leave <varname>fsync</varname> enabled. The default is
1283
1284
to enable <varname>fsync</varname>, for maximum reliability.
1284
1285
If you trust your operating system, your hardware, and your
@@ -1288,9 +1289,9 @@ SET ENABLE_SEQSCAN TO OFF;
1288
1289
1289
1290
<para>
1290
1291
This option can only be set at server start or in the
1291
- <filename>postgresql.conf</filename> file. Ifthis option
1292
- is <literal> off</>, consider also turning off
1293
- <varname> guc-full-page-writes</ >.
1292
+ <filename>postgresql.conf</filename> file. Ifyou turn
1293
+ this option off, also consider turning off
1294
+ <xref linkend=" guc-full-page-writes" >.
1294
1295
</para>
1295
1296
</listitem>
1296
1297
</varlistentry>
@@ -1302,8 +1303,10 @@ SET ENABLE_SEQSCAN TO OFF;
1302
1303
</indexterm>
1303
1304
<listitem>
1304
1305
<para>
1305
- Method used for forcing WAL updates out to disk. Possible
1306
- values are:
1306
+ Method used for forcing WAL updates out to disk.
1307
+ If <varname>fsync</varname> is off then this setting is irrelevant,
1308
+ since updates will not be forced out at all.
1309
+ Possible values are:
1307
1310
</para>
1308
1311
<itemizedlist>
1309
1312
<listitem>
@@ -1313,17 +1316,17 @@ SET ENABLE_SEQSCAN TO OFF;
1313
1316
</listitem>
1314
1317
<listitem>
1315
1318
<para>
1316
- <literal>fdatasync</> (call <function>fdatasync()</> at each commit),
1319
+ <literal>fdatasync</> (call <function>fdatasync()</> at each commit)
1317
1320
</para>
1318
1321
</listitem>
1319
1322
<listitem>
1320
1323
<para>
1321
- <literal>fsync </> (call <function>fsync()</> at each commit)
1324
+ <literal>fsync_writethrough </> (call <function>fsync()</> at each commit, forcing write-through of any disk write cache )
1322
1325
</para>
1323
1326
</listitem>
1324
1327
<listitem>
1325
1328
<para>
1326
- <literal>fsync_writethrough </> (force write-through of any disk write cache )
1329
+ <literal>fsync </> (call <function>fsync()</> at each commit )
1327
1330
</para>
1328
1331
</listitem>
1329
1332
<listitem>
@@ -1334,8 +1337,7 @@ SET ENABLE_SEQSCAN TO OFF;
1334
1337
</itemizedlist>
1335
1338
<para>
1336
1339
Not all of these choices are available on all platforms.
1337
- The top-most supported option is used as the default.
1338
- If <varname>fsync</varname> is off then this setting is irrelevant.
1340
+ The default is the first method in the above list that is supported.
1339
1341
This option can only be set at server start or in the
1340
1342
<filename>postgresql.conf</filename> file.
1341
1343
</para>
@@ -1349,21 +1351,37 @@ SET ENABLE_SEQSCAN TO OFF;
1349
1351
<term><varname>full_page_writes</varname> (<type>boolean</type>)</term>
1350
1352
<listitem>
1351
1353
<para>
1352
- A page write in process during an operating system crash might
1353
- be only partially written to disk, leading to an on-disk page
1354
- that contains a mix of old and new data. During recovery, the
1355
- row changes stored in WAL are not enough to completely restore
1356
- the page.
1354
+ When this option is on, the <productname>PostgreSQL</> server
1355
+ writes the entire content of each disk page to WAL during the
1356
+ first modification of that page after a checkpoint.
1357
+ This is needed because
1358
+ a page write that is in process during an operating system crash might
1359
+ be only partially completed, leading to an on-disk page
1360
+ that contains a mix of old and new data. The row-level change data
1361
+ normally stored in WAL will not be enough to completely restore
1362
+ such a page during post-crash recovery. Storing the full page image
1363
+ guarantees that the page can be correctly restored, but at a price
1364
+ in increasing the amount of data that must be written to WAL.
1365
+ (Because WAL replay always starts from a checkpoint, it is sufficient
1366
+ to do this during the first change of each page after a checkpoint.
1367
+ Therefore, one way to reduce the cost of full-page writes is to
1368
+ increase the checkpoint interval parameters.)
1357
1369
</para>
1358
1370
1359
1371
<para>
1360
- When this option is on, the <productname>PostgreSQL</> server
1361
- writes full pages to WAL when they are first modified after a
1362
- checkpoint so crash recovery is possible. Turning this option off
1363
- might lead to a corrupt system after an operating system crash
1364
- or power failure because uncorrected partial pages might contain
1365
- inconsistent or corrupt data. The risks are less but similar to
1366
- <varname>fsync</>.
1372
+ Turning this option off speeds normal operation, but
1373
+ might lead to a corrupt database after an operating system crash
1374
+ or power failure. The risks are similar to turning off
1375
+ <varname>fsync</>, though smaller. It may be safe to turn off
1376
+ this option if you have hardware (such as a battery-backed disk
1377
+ controller) or filesystem software (e.g., Reiser4) that reduces
1378
+ the risk of partial page writes to an acceptably low level.
1379
+ </para>
1380
+
1381
+ <para>
1382
+ Turning off this option does not affect use of
1383
+ WAL archiving for point-in-time recovery (PITR)
1384
+ (see <xref linkend="backup-online">).
1367
1385
</para>
1368
1386
1369
1387
<para>
@@ -1384,7 +1402,7 @@ SET ENABLE_SEQSCAN TO OFF;
1384
1402
Number of disk-page buffers allocated in shared memory for WAL data.
1385
1403
The default is 8. The setting need only be large enough to hold
1386
1404
the amount of WAL data generated by one typical transaction, since
1387
- the data isflushed to disk at every transaction commit.
1405
+ the data iswritten out to disk at every transaction commit.
1388
1406
This option can only be set at server start.
1389
1407
</para>
1390
1408
@@ -1481,8 +1499,9 @@ SET ENABLE_SEQSCAN TO OFF;
1481
1499
<para>
1482
1500
Write a message to the server log if checkpoints caused by
1483
1501
the filling of checkpoint segment files happen closer together
1484
- than this many seconds. The default is 30 seconds.
1485
- Zero turns off the warning.
1502
+ than this many seconds (which suggests that
1503
+ <varname>checkpoint_segments</> ought to be raised). The default is
1504
+ 30 seconds. Zero disables the warning.
1486
1505
</para>
1487
1506
</listitem>
1488
1507
</varlistentry>