</para>
<para>
- The <varname>COMMIT_DELAY</varname> parameter defines for how long
- the backend will be forced to sleep after writing a commit record
- to the log with <function>LogInsert</function> call but before
+ The <varname>COMMIT_DELAY</varname> parameter defines for how many
+ microseconds the backend will sleep after writing a commit
+ record to the log with <function>LogInsert</function> but before
performing a <function>LogFlush</function>. This delay allows other
backends to add their commit records to the log so as to have all
of them flushed with a single log sync. Unfortunately, this
mechanism is not fully implemented at release 7.1, so there is at
- present no point in changing this parameter from its default value
- of 5 microseconds.
+ present usually no benefit to be gained from increasing this parameter
+ above its default value of zero.
</para>
</sect1>
</chapter>
#include "access/xlogutils.h"
-int CommitDelay = 5; /* 1/200000 sec */
+int CommitDelay = 0; /* in microseconds */
static void (*_RollbackFunc)(void*) = NULL;
static void *_RollbackData = NULL;
{
XLogRecData rdata;
xl_xact_commit xlrec;
- struct timeval delay;
XLogRecPtr recptr;
BufmgrCommit();
/*
* Sleep before commit! So we can flush more than one
- * commit records per single fsync.
+ * commit records per single fsync. (The idea is some other
+ * backend may do the XLogFlush while we're sleeping. This
+ * needs work however, because on most Unixen, the minimum
+ * select() delay is 10msec or more, which is way too long.)
*/
- delay.tv_sec = 0;
- delay.tv_usec = CommitDelay;
- (void) select(0, NULL, NULL, NULL, &delay);
+ if (CommitDelay > 0)
+ {
+ struct timeval delay;
+
+ delay.tv_sec = 0;
+ delay.tv_usec = CommitDelay;
+ (void) select(0, NULL, NULL, NULL, &delay);
+ }
+
XLogFlush(recptr);
MyLastRecPtr.xrecoff = 0;
#wal_buffers = 8 # min 4
#wal_files = 0 # range 0-64
#wal_debug = 0 # range 0-16
-#commit_delay = 5 # range 0-1000
+#commit_delay = 0 # range 0-100000
#checkpoint_timeout = 300 # range 30-1800