Re: Force WAL cleanup on running instance

Поиск
Список
Период
Сортировка
От Justin
Тема Re: Force WAL cleanup on running instance
Дата
Msg-id CALL-XeNreM=MgoxK8e2XNDfyQUMgx45Fv0n-m1=TvB0sei3udw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Force WAL cleanup on running instance  (Simon Riggs <simon@2ndquadrant.com>)
Ответы Re: Force WAL cleanup on running instance
Список pgsql-general
Question everyone isn't this a problem with the order of operations?

switching the wal files  then running checkpoint means the Checkpoint can cross wal files,  so the previous wal file can not be deleted???

To my understanding the order operations should be

Checkpoint
which  flushes everything to disk, then
pg_switch_wal()

which creates an empty wal file and the previous wal can be deleted?
 

Or am i missing something?

On Wed, Mar 11, 2020 at 11:45 AM Simon Riggs <simon@2ndquadrant.com> wrote:
On Wed, 11 Mar 2020 at 08:59, Torsten Krah <krah.tm@gmail.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/
PostgreSQL Solutions for the Enterprise

В списке pgsql-general по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Force WAL cleanup on running instance
Следующее
От: Torsten Krah
Дата:
Сообщение: Re: Force WAL cleanup on running instance