WAL settings
The PostgreSQL Write-Ahead Log (WAL) was described in Chapter 5, Memory for Database Caching.
wal_buffers
While the documentation on wal_buffers
suggests that the default of 64 KB is sufficient as long as no single transaction exceeds that value, in practice write-heavy benchmarks see optimal performance at higher values than you might expect from that, at least 1 MB or more. With the only downside being the increased use of shared memory, and as there's no case where more than a single WAL segment could need to be buffered, given modern server memory sizes the normal thing to do nowadays is to just set:
wal_buffers=16MB
Then forget about it as a potential bottleneck or item to tune further. Only if you're tight on memory should you consider a smaller setting.
wal_sync_method
The Chapter 2, Database Hardware, touched on the importance of setting up your server to avoid volatile write-back caches. One purpose of wal_sync_method
is to tune such caching...