PG_ARCHIVECLEANUP(1) PostgreSQL 18.6 Documentation PG_ARCHIVECLEANUP(1) (NAME) pg_archivecleanup - WAL PostgreSQL (SYNOPSIS) pg_archivecleanup [option...] archivelocation oldestkeptwalfile (DESCRIPTION) pg_archivecleanup archive_cleanup_command WAL standby ( 26.2 ) . pg_archivecleanup WAL . standby pg_archivecleanup postgresql.conf : archive_cleanup_command = 'pg_archivecleanup archivelocation %r' archivelocation WAL . archive_cleanup_command WAL %r archivelocation . (crash-restart) . archivelocation (staging) standby archivelocation WAL standby . WAL oldestkeptwalfile archivelocation . .partial .backup oldestkeptwalfile . .backup WAL (base backup) . WAL 000000010000003700000010 : pg_archivecleanup -d archive 000000010000003700000010.00000020.backup pg_archivecleanup: keep WAL file "archive/000000010000003700000010" and later pg_archivecleanup: removing file "archive/00000001000000370000000F" pg_archivecleanup: removing file "archive/00000001000000370000000E" pg_archivecleanup archivelocation . (OPTIONS) pg_archivecleanup : -b --clean-backup-history (backup history) . 25.3.2 . -d --debug stderr. -n --dry-run stdout ( ). -V --version pg_archivecleanup . -x extension --strip-extension=extension . . : -x .gz. -? --help pg_archivecleanup . (ENVIRONMENT) PG_COLOR . always auto never. (NOTES) pg_archivecleanup PostgreSQL 8.0 PostgreSQL 9.0 . pg_archivecleanup C . (EXAMPLES) : archive_cleanup_command = 'pg_archivecleanup -d /mnt/standby/archive %r 2>>cleanup.log' standby archive_command NFS standby . : o cleanup.log o PostgreSQL 18.6 2026 PG_ARCHIVECLEANUP(1)