pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Marques <martin.marques@2ndquadrant.com>
To: magodo <wztdyl@sina.com>
To: Postgres general <pgsql-general@postgresql.org>
Subject: Re: how to cleanup archive based on datetime
Date: Wed, 10 Oct 2018 11:23:40 -0300
Message-ID: <6d0bf038-d4ad-033a-38bd-94c01e9e4b4d@2ndquadrant.com> (raw)
In-Reply-To: <ca8e01bfc65c41ea223c3b57a8179c95f1a79ec4.camel@sina.com>
References: <ca8e01bfc65c41ea223c3b57a8179c95f1a79ec4.camel@sina.com>

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




view thread (3+ messages)

Message-ID: <6d0bf038-d4ad-033a-38bd-94c01e9e4b4d@2ndquadrant.com>
Permalink:  ../6d0bf038-d4ad-033a-38bd-94c01e9e4b4d@2ndquadrant.com/
Also on:    postgresql.org/message-id/6d0bf038-d4ad-033a-38bd-94c01e9e4b4d@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: martin.marques@2ndquadrant.com, wztdyl@sina.com
  Subject: Re: how to cleanup archive based on datetime
  In-Reply-To: <6d0bf038-d4ad-033a-38bd-94c01e9e4b4d@2ndquadrant.com>
  References: <ca8e01bfc65c41ea223c3b57a8179c95f1a79ec4.camel@sina.com> <6d0bf038-d4ad-033a-38bd-94c01e9e4b4d@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox