Re: Deleting old WAL-files

From: Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "'Gustav Karlsson *EXTERN*'" <Gustav(dot)Karlsson(at)BEKK(dot)no>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Deleting old WAL-files
Date: 2015-05-19 12:09:17
Message-ID: A737B7A37273E048B164557ADEF4A58B36612994@ntex2010i.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Gustav Karlsson wrote:
> I am looking for a good method of determining what WAL-segments can be deleted from our backup-
> archive.
>
> We are using Postgresql 9.3 and do nightly basebackups along with archiving of WAL-segments.
>
> We would like to prevent our backup-archive from growing forever, and thus delete basebackups and WAL-
> segments older than say 1 year.
>
> Is there a good way of finding the oldest WAL-segment needed for a given basebackup? (If not, what is
> the typical method for deleting old WAL-segments?)

The backup contains a file "backup_label" which contains a line like

START WAL LOCATION: 0/83000028 (file 000000010000000000000083)

That is the oldest file needed for recovery.

But a simple solution would be to keep WAL archives for one day more than your oldest
base backup, that way you can never miss a WAL archive that you need.

Yours,
Laurenz Albe

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Matheus de Oliveira 2015-05-19 12:53:10 Re: Create Index CONCURRENTLY Hangs Indefinitely.
Previous Message Jan Lentfer 2015-05-19 11:52:39 Re: Deleting old WAL-files