Thread: Logical Replication - PG_Wall size is too big, What can I do ?

Logical Replication - PG_Wall size is too big, What can I do ?

From
Jaurès FOUTE KUETE
Date:
Hello Everyone,

We are facing this issue and want to know how can I do to clean this folder without problem.

image.png
What can be the cause of that ?
and How can I clean this folder without stopping Logical Replication ?

Best Regards
Jaurès FOUTE
Attachment

Re: Logical Replication - PG_Wall size is too big, What can I do ?

From
Laurenz Albe
Date:
On Tue, 2024-07-09 at 07:05 +0100, Jaurès FOUTE KUETE wrote:
> [image showing a large "pg_wal" directory]
>
> We are facing this issue and want to know how can I do to clean this folder without problem.
>
> What can be the cause of that ?
> and How can I clean this folder without stopping Logical Replication ?

The cause is logical replication (probably the initial synchronization of
the tables), and the only way to clean that directory is to abort logical
replication.

PostgreSQL has to retain all WAL (transaction log) until copying the data
is done and it can actually start decoding.

One way to reduce the impact is to add tables to the publication one
after the other (and refreshing the publication each time).  Copying the
data for a single table can finish faster, and logical replication can
start catching up sooner, so PostgreSQL doesn't have to keep so much WAL.

Yours,
Laurenz Albe