Reputation: 13
i have a legacy postgreSQL DB and the pg_wal size is very huge, how to safely remove the early files inside pg_wal directory to reduce the pg_wal size without interrupting the current database? Thank you
Upvotes: 1
Views: 6581
Reputation: 246082
There is no safe way to manually remove files in pg_wal
. Don't do it.
You have to figure out the reason that keeps PostgreSQL from deleting the files. A stale replication slot? Is the archiver stuck? Is wal_keep_size
(wal_keep_segments
in older releases) large?
Once you have fixed the problem, the situation will gradually improve. WAL segments are automatically deleted during checkpoints.
Upvotes: 2