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?


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

| improve this answer | |
  • 2
    Correct. Congratulations, you didn't corrupt your database! pg_archivecleanup would also be OK if you didn't have WAL archiving (barman, etc) or streaming replicas. – Craig Ringer Mar 5 '17 at 11:26
  • What all are the options did you comment in postgresql.conf file ? – Raviteja Nov 8 '17 at 10:33
  • The ones stated in the question. – Fabrizio Mazzoni Nov 8 '17 at 10:35
  • Actually, my PG started outputting 'archive command failed' after I used pg_archivecleanup. I had to nevertheless stop the DB, comment-out those params and restart. – gilad mayani Mar 21 '18 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.