my main question – why pg_wal dir is extremely growing up?
I have two postgresql instances.
The first was set up as master:
wal_level: "logical"
max_wal_senders: 5
max_replication_slots: 10
Also, I was enable archiving for pg_wal:
archive_mode: on
archive_command: 'gzip < %p > /.../data/pg_wal_archive/%f'
After that, PUBLICATION
was created for some of my tables (not ALL TABLES
)
For replication
psql instance – I using default psql config, only created SUBSCRIPTION
to master.
And I have two questions:
-
I run some script on master, which pulling ~ 10 Gb data to one table, which was not included in the PUBLICATION. And, I see, that my
pg_wal
dir size is increasing anyway. Why? -
Why pg_wal dir does not cleaning? Is it normal? Looks like I have some data for restore table which is not using in replication, how to delete this data?
Best Answer
archive_mode is used for for archiving, regardless of standby configuration. It can be used for point in time recovery. So when you perform DML on any table, it will generate WAL.
For cleaning up you can use archive_cleanup_command from recovery.conf