Re: Force WAL cleanup on running instance

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: krah(dot)tm(at)gmail(dot)com
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Force WAL cleanup on running instance
Date: 2020-03-11 15:45:06
Message-ID: CANP8+j+q05ZsoZieAwJrbniOZmWjo6hXhzW4X86uL4HqdF-y_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 11 Mar 2020 at 08:59, Torsten Krah <krah(dot)tm(at)gmail(dot)com> wrote:

> Hi,
>
> I am building a docker image with a postgresql 12.2 instance and while
> doing so and importing a dump and running some update scripts wal size
> is increasing.
>
> When finished I don't need all those wal files anymore and tried to
> force the daemon to clean them up and tried this:
>
> select pg_switch_wal();
> CHECKPOINT;
>
> and did wait for a minute.
>
> Sometimes it works and wal files are cleaned and moved away so my image
> size is way smaller - but it does not happen always in that minute.
>
> So is there a way to tell postgres to force the housekeeping of the wal
> stuff via a statement / command line tool?
> In a "normal" running instance it just takes care of itself and it will
> happen sooner or later and it doesn't really matter when that will
> happen - but with my docker image which is automatically build it would
> be nice to have a deterministic way of trigger that to reduce the final
> size image.

The size of the task varies, so sometimes takes longer than 60s, depending
upon your hardware.

--
Simon Riggs http://www.2ndQuadrant.com/
<http://www.2ndquadrant.com/>
PostgreSQL Solutions for the Enterprise

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Justin 2020-03-11 15:51:45 Re: Force WAL cleanup on running instance
Previous Message Tom Lane 2020-03-11 15:37:59 Re: ERROR: invalid memory alloc request size 1073741824