Re: how to cleanup archive based on datetime

From: Martin Marques <martin(dot)marques(at)2ndquadrant(dot)com>
To: magodo <wztdyl(at)sina(dot)com>, Postgres general <pgsql-general(at)postgresql(dot)org>
Subject: Re: how to cleanup archive based on datetime
Date: 2018-10-10 14:23:40
Message-ID: 6d0bf038-d4ad-033a-38bd-94c01e9e4b4d@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El 10/10/18 a las 04:00, magodo escribió:
>
> Hello,
>
> I know there is a tool `pg_archivecleanup`, but it only accepts wal
> filename. What if I want to clean up all archived wal before a
> specified datetime?
>
> Though I could check the ctime fo each wal and figure out which to
> remove, but it looks like not a elegent way to do this.
>
> Also I tried to parse each wal and compare with the specified datetime
> in a binary-search way, but it is based on the fact that every COMMIT
> time in wal is sequential, but it looks like not the case..
>
> Hence I wonder what is the best practice for this task?

Don't do that manually. Install `barman` and let it take care of
removing old WALs which are not needed anyore.

Regards,

--
Martín Marqués http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bryce Pepper 2018-10-10 14:37:13 RE: RHEL 7 (systemd) reboot
Previous Message Adrian Klaver 2018-10-10 14:14:39 Re: how to cleanup archive based on datetime