Force WAL cleanup on running instance

From: Torsten Krah <krah(dot)tm(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Force WAL cleanup on running instance
Date: 2020-03-11 08:59:41
Message-ID: 3f91429eb65ac8aa3c77361c587e786a290b92f0.camel@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Is there some way to trigger this?

kind regards

Torsten

--

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nicola Contu 2020-03-11 09:54:52 Re: Streaming replication - 11.5
Previous Message PegoraroF10 2020-03-11 08:22:04 Re: How to discover what table is