diff --git a/doc/src/sgml/wal.sgml b/doc/src/sgml/wal.sgml index 45c41ea0b5..7f603221ac 100644 --- a/doc/src/sgml/wal.sgml +++ b/doc/src/sgml/wal.sgml @@ -1,4 +1,4 @@ - + Write-Ahead Logging (<acronym>WAL</acronym>) @@ -222,33 +222,6 @@ configuration parameters. - - There are two commonly used WAL functions: - LogInsert and LogFlush. - LogInsert is used to place a new record into - the WAL buffers in shared memory. If there is no - space for the new record, LogInsert will have - to write (move to kernel cache) a few filled WAL - buffers. This is undesirable because LogInsert - is used on every database low level modification (for example, - tuple insertion) at a time when an exclusive lock is held on - affected data pages, so the operation needs to be as fast as - possible. What is worse, writing WAL buffers may - also force the creation of a new log segment, which takes even more - time. Normally, WAL buffers should be written - and flushed by a LogFlush request, which is - made, for the most part, at transaction commit time to ensure that - transaction records are flushed to permanent storage. On systems - with high log output, LogFlush requests may - not occur often enough to prevent WAL buffers - being written by LogInsert. On such systems - one should increase the number of WAL buffers by - modifying the postgresql.conf - WAL_BUFFERS parameter. The default number of - WAL buffers is 8. Increasing this value will - correspondingly increase shared memory usage. - - Checkpoints are points in the sequence of transactions at which it is guaranteed that the data files have @@ -265,19 +238,6 @@ or removed.) - - The checkpoint maker is also able to create a few log segments for - future use, so as to avoid the need for - LogInsert or LogFlush to - spend time in creating them. (If that happens, the entire database - system will be delayed by the creation operation, so it's better if - the files can be created in the checkpoint maker, which is not on - anyone's critical path.) - By default a new 16MB segment file is created only if more than 75% of - the current segment has been used. This is inadequate if the system - generates more than 4MB of log output between checkpoints. - - The postmaster spawns a special backend process every so often to create the next checkpoint. A checkpoint is created every @@ -303,16 +263,43 @@ There will be at least one 16MB segment file, and will normally - not be more than CHECKPOINT_SEGMENTS + not be more than 2 * CHECKPOINT_SEGMENTS + 1 files. You can use this to estimate space requirements for WAL. Ordinarily, when old log segment files are no longer needed, they are recycled (renamed to become the next sequential future segments). If, due to a short-term peak of log output rate, there - are more than CHECKPOINT_SEGMENTS + 1 segment files, + are more than 2 * CHECKPOINT_SEGMENTS + 1 segment files, the unneeded segment files will be deleted instead of recycled until the system gets back under this limit. + + There are two commonly used WAL functions: + LogInsert and LogFlush. + LogInsert is used to place a new record into + the WAL buffers in shared memory. If there is no + space for the new record, LogInsert will have + to write (move to kernel cache) a few filled WAL + buffers. This is undesirable because LogInsert + is used on every database low level modification (for example, + tuple insertion) at a time when an exclusive lock is held on + affected data pages, so the operation needs to be as fast as + possible. What is worse, writing WAL buffers may + also force the creation of a new log segment, which takes even more + time. Normally, WAL buffers should be written + and flushed by a LogFlush request, which is + made, for the most part, at transaction commit time to ensure that + transaction records are flushed to permanent storage. On systems + with high log output, LogFlush requests may + not occur often enough to prevent WAL buffers + being written by LogInsert. On such systems + one should increase the number of WAL buffers by + modifying the postgresql.conf + WAL_BUFFERS parameter. The default number of + WAL buffers is 8. Increasing this value will + correspondingly increase shared memory usage. + + The COMMIT_DELAY parameter defines for how many microseconds the backend will sleep after writing a commit