postgresql when it's not your job

13:00

Change these: archive_mode and archive_command

3 April 2018

(An intermittent series on PostgreSQL parameters whose default settings you should change.)

By default archive_mode is set to off, and thus archive_command is ignored. Even if you are not going to be using WAL archiving, you should change these. You can use settings such as:

archive_mode = on
archive_command = '/bin/true'

It requires a server restart to turn on archive_mode, but just a reload to change archive_command. Thus, you’re ready to start WAL archiving without a restart by getting these set in advance.

Marti Raudsepp at 03:05, 4 April 2018:

Importantly, setting archive_mode=on also requires wal_level=archive (or higher, anything but ‘minimal’). The performance impact is generally negligible, except for maintenance commands. More info: https://www.postgresql.org/docs/current/static/runtime-config-wal.html#GUC-WAL-LEVEL

Strahinja Kustudic at 10:46, 8 April 2018:

Both are set like this by default with our Ansible Postgres role for a few years now, as well as wal_level to the highest level. You never know when will you configure replication, and performance impact is negligible.