Re: PostgreSQL Archive Log Partition Reaching 95% – Need Automated Cleanup

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: loganathan P <plogandba(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL Archive Log Partition Reaching 95% – Need Automated Cleanup
Date: 2026-03-03 14:48:01
Message-ID: 613e378c68d816e700a694f97d3a49b8afed7678.camel@cybertec.at
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2026-03-03 at 19:51 +0530, loganathan P wrote:
> We have PostgreSQL 15 and PostgreSQL 17 databases running in separate environments on different servers.
> Each database is approximately 1.5 TB in size and highly active, generating around 500 GB of archive
> logs per day. We have VM SRM replication configured.
>
> The archive log partition reaches 95–100% utilization before backups are taken. After the backups are
> completed, we must manually remove the archived log files to free up space.
>
> Could you please advise whether PostgreSQL has any built-in parameters or mechanisms to automatically
> delete archived log files once they have been successfully backed up?

Since PostgreSQL doesn't know about your archives, there is no way for it to clean
up automatically. You have to do that yourself.

There is the "pg_archivecleanup" utility that you can use with the backup file
generated in the WAL archive:

pg_archivecleanup /mnt/server/archivedir 000000010000000000000010.00000020.backup

The easiest way would be to use a backup software like pgBackRest that does these
things for you.

Yours,
Laurenz Albe

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2026-03-03 15:53:53 Re: Timezone handling with timestamp without time zone columns
Previous Message loganathan P 2026-03-03 14:21:31 PostgreSQL Archive Log Partition Reaching 95% – Need Automated Cleanup