I'm relatively new to PostgreSQL administration and I'm attempting to pick up the nitty gritty details as I go. My question is, assuming I have no need for disaster recovery and I don't turn on archiving by setting up archive_mode = on
, does Postgres have an internal mechanism to rotate WAL files out of pg_xlog
? if so, what is the frequency?
On a slightly different note, what is the impact of setting archive_mode = on
but not configuring an archive_command
– is there a default location Postgres will attempt to archive to?
Best Answer
If
archive_mode = off
, PostgreSQL will delete old WAL files as soon as they are older than the latest checkpoint. These checkpoints occur by default at least every 5 minutes, so there should never be many old WAL files around.If you set
archive_mode = on
, a WAL file are only deleted oncearchive_command
has returned success for that file. An emptyarchive_command
should always do that immediately. It is a tradition to setarchive_command = '/bin/true'
to indicate that you temporarily disabled archiving.