2

I've got a task to work with a 9.6 Postgres DB, and for some reason Autovacuum is disabled.

The database was extremely slow, and after a manual VACUUM it could breathe again.

The point is, why disable Autovaccum? Is there any practical scenario for a small database to have Autovaccum disabled?

2
  • 2
    There is absolutely no reason to disable it. Whoever did that, did no have a clue on how to properly manage a Postgres database
    – user1822
    Aug 8, 2019 at 15:01
  • 2
    @a_horse_with_no_name what if you have a db with high load half of the day and almost no use the other half? Wouldn't it be a good idea disable autovacuum and schedule a manual vacuum?
    – EAmez
    Aug 9, 2019 at 7:08

1 Answer 1

3

There is no good reason to keep autovacuum disabled in a production database, and you will run into problems if you do that.

It may make sense to disable autovacuum during exceptional operations, where you run a manual vacuum anyway and don't want your performance sapped by a background job, but more often than not such trickery is a premature optimization.

I would run VACUUM (FULL) on the database, followed by VACUUM (ANALYZE). That shoud take care of any damage done.

Then enable autovacuum.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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