Search code examples
postgresqldatabase-administrationenterprisedbpostgres-plus

How to avoid a big log file with WAL archiving?


I enabled WAL archiving in EDB Postgresql 9.6 for PITR, but now every time a 16MB log file is created and filling Disk volume. How do I avoid that?

These are the changes made to Postgresql.conf to enable the wal archive:

wal_level = replica
archive_mode =  on
archive_command = 'cp %p /postgres/cluster/wals/%f'

(cp from pg_xlogs to wals folder)

Now the wal folder is filling every time.


Solution

  • You avoid filling up the destination directory by

    • providing enough disk space there

    • deleting WAL archives you don't need any more.

    PostgreSQL does not automatically delete WAL archives for you — it does not even know where they are.