Setting commit_delay = 300 (which is 300 microseconds) in PostgreSQL allows you to group write commits. And flush them by a single transaction.

This is in particularly useful if you have a lot of writes to the disk in a short time window, this will reduce the disk I/O bursts.

You could also set synchronous_commit = off as well. So there will not be a flush earlier than the specified wal_writer_delay. However, only turn this off, if your performance is more important than your data integrity. That being said, it will not cause corruptions, unlike the fsync setting (which I would strongly advise to NOT change, so keep fsync on the default setting).

And then we have wal_writer_delay. Which is the time in milliseconds how often the WAL gets flushed. This option only works when synchronous_commit if set to off!! You most likely do not need to increase the wal_writer_delay value (in fact, you might even want to lower this value).

Official docs: https://postgresqlco.nf/doc/en/param/commit_delay/

Settings to point out are in random order:

See more PostgreSQL fine-tuning at: https://gitlab.melroy.org/-/snippets/610