Skip to content

Impact of synchronous_commit and fsync

dbacvetkov edited this page Jul 9, 2018 · 6 revisions

Let's look for example at the charts with database load when different values of synchronous_commit/fsync are set.

I used a pgbench with the following parameters:

pgbench -b simple-update -c 30 -T600 -R 3000 postgres

"-R 3000" means target rate 3000 transactions per second, to make identical load in every case.

I ran the load three times:

  1. synchronous_commit = on, fsync = on.
  2. synchronous_commit = off, fsync = on.
  3. synchronous_commit = off, fsync = off.

You may notice that in second run we got rid of LWLock wait type (deep red). Now look at Details -> LWLock and see that it was WALWriteLock (because i have slow disks).

Also you may notice that there is not much difference between second and third runs. So there's no point in setting dangerous parameter fsync=off.