Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gAEX3-0007jy-I6 for pgsql-general@arkaria.postgresql.org; Wed, 10 Oct 2018 13:28:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gAEWz-00038Q-NL for pgsql-general@arkaria.postgresql.org; Wed, 10 Oct 2018 13:28:05 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gA8Th-0000zm-Hw for pgsql-general@lists.postgresql.org; Wed, 10 Oct 2018 07:00:17 +0000 Received: from mail3-164.sinamail.sina.com.cn ([202.108.3.164]) by makus.postgresql.org with smtp (Exim 4.89) (envelope-from ) id 1gA8Tb-0004Lm-Ui for pgsql-general@postgresql.org; Wed, 10 Oct 2018 07:00:14 +0000 Received: from unknown (HELO t460p)([120.132.1.226]) by sina.com with ESMTP id 5BBDA37500001A73; Wed, 10 Oct 2018 15:00:06 +0800 (CST) X-Sender: wztdyl@sina.com X-Auth-ID: wztdyl@sina.com X-SMAIL-MID: 311346394020 Message-ID: Subject: how to cleanup archive based on datetime From: magodo To: Postgres general Date: Wed, 10 Oct 2018 15:00:07 +0800 Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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? Thank you in advance! --- Magodo