Re: how to cleanup archive based on datetime

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(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:14:39
Message-ID: 45fd9e0f-9023-3a6a-7e3e-9da41fa006f9@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/10/18 12:00 AM, magodo wrote:
>
> 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?

That is dangerous, given that a WAL is important not based on its age
but on whether it's content is still needed.

It would help to know what it is you are trying to achieve?

>
> 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?
>
> Thank you in advance!
> ---
> Magodo
>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Marques 2018-10-10 14:23:40 Re: how to cleanup archive based on datetime
Previous Message Martin Marques 2018-10-10 14:06:00 Re: Barman issue