Postgresql – How to clear pg_xlog directory

postgresqlpostgresql-9.4transaction-log

I have found myself in a situation where the pg_xlog contains 60GB of data due to a wrong configuration option set.

I had setup the wal_level, archive_mode=on and archive_command for barman which then got uninstalled. Can I simply comment these options as per default postgresql.conf config file and delete the files in the pg_xlog directory?

What is the correct procedure to remove these files in order to avoid database corruption?

Best Answer

Managed to solve it quite simply. Stopped the db, commented the options in postgresql.conf and restarted. PostgreSQL took care of deleting everything automatically.