Postgresql – Is it safe to kill vacuumdb

postgresqlvacuum

I would like to schedule a vacuumdb cron job for an entire database, but I don't want it to run past a certain time. Is it safe to just stop the job with killall vacuumdb?

Best Answer

Yes, it's safe. Use SIGTERM (the default, signal 15 on Linux) not SIGKILL (signal 9). If it doesn't complete it might waste recent work and have to repeat it.

However, you should really just let autovacuum do its job.