Search code examples
postgresqlpostgresql-12

Postgresql pg_basebackup and archive_command


I'm considering the delete archive_command due to the pg_basebackup introduction which executed is during replication. I'm not sure if I understand it correctly - I assume that I don't need archive_command, because pg_basebackup -X stream - will backup also the pg_wal directory, so I don't want to duplicate WALs made by archive_command.

Could you tell me if it's a good option? Thanks.


Solution

  • Without a WAL archive, a backup can only be restored as of a single point in time, the moment when the backup task finished.

    With a WAL archive, you can restore to any point in time going forward from when the backup finished up until the most recent WAL file archival. Whether this ability is of any value to you is something you need to answer for yourself.

    If you do keep an archive, then you can do the basebackup with -X none to avoid duplicating WALs. Although I would think the extra protection of having a few key WAL files duplicated is usually worth the extra space.