6

I'm using PostgreSQL 9.3 on RDS. Once in a while, I run a VACUUM FULL operation on the database. However, such operation can take quite a while and it blocks other tables, so the need to stop the operation might arise.

Is it safe to stop a VACUUM FULL operation that takes too long?

7

Yes, it is safe. Vacuum full will recreate the tables as new objects and only when they're done they will be put to use. If you cancel it, the new files not yet put to use will be removed and old ones will be kept.

Of course if you would cancel it by killing the process handling the vacuum there would be files left, but still the database would be intact.

  • 1
    Thanks, this seems reasonable. Do you know of any official reference to this behaviour? I could not find any in the documentation. – Adam Matan Aug 8 '15 at 17:55
  • 1
    Nothing specific, usually they would mention if there was a problem. There is an email from Tom Lane mentioning that normal cancelation won't be a problem even in the 8 series and 9 series it would be even less of a problem I assume. grokbase.com/t/postgresql/pgsql-general/10an6ffe3j/… – Sami Kuhmonen Aug 8 '15 at 18:02
  • I'm sure I've read somewhere that it's never a good idea to cancel a vacuum. – PhilHibbs Jun 16 '16 at 13:50

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.