21

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?

Adam Matan
  • 11,659
  • 29
  • 80
  • 95

1 Answers1

21

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.

Sami Kuhmonen
  • 726
  • 5
  • 8
  • 2
    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 08 '15 at 17:55
  • 2
    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. http://grokbase.com/t/postgresql/pgsql-general/10an6ffe3j/full-vacuum-cancelation – Sami Kuhmonen Aug 08 '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