Byte
Byte

Reputation: 3

Is that safe to restart postgresql server while vacuum full running? Or kill the vacuumdb processes?

I got my vacuumdb running, but accidentally i start it multiple times with statement_timeout = 0 parameter, so im afraid that this can take to much time to complete.

My question is, can i safely kill the process of theese vacuum or just restart server while its running?

xxx=# select pid, backend_start, query_start, state_change, state, query from pg_stat_activity where application_name = 'vacuumdb' OR query like '%reload%';


pid  |         backend_start         |          query_start          |         state_change          | state  |                                                                         query                                                                          
-------+-------------------------------+-------------------------------+-------------------------------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------
  1273 | 2017-03-25 13:18:48.355737+03 | 2017-03-25 13:18:56.318492+03 | 2017-03-25 13:18:56.319311+03 | idle   | select pg_reload_conf();
 32102 | 2017-03-25 13:14:26.737586+03 | 2017-03-25 13:14:26.74256+03  | 2017-03-25 13:14:26.742566+03 | active | VACUUM (FULL, VERBOSE, ANALYZE) xxx;                                                                                                  +
       |                               |                               |                               |        | 
  2693 | 2017-03-25 13:22:44.275979+03 | 2017-03-25 13:46:48.168615+03 | 2017-03-25 13:46:48.168625+03 | active | select pid, backend_start, query_start, state_change, state, query from pg_stat_activity where application_name = 'vacuumdb' OR query like '%reload%';
 31746 | 2017-03-25 13:13:07.173855+03 | 2017-03-25 13:13:07.178614+03 | 2017-03-25 13:13:07.178621+03 | active | VACUUM (FULL, VERBOSE, ANALYZE) xxx;                                                                                                  +
       |                               |                               |                               |        | 
 16923 | 2017-03-25 12:28:31.537226+03 | 2017-03-25 12:28:31.543027+03 | 2017-03-25 12:28:31.543032+03 | active | VACUUM (FULL, VERBOSE, ANALYZE) xxx;                                                                                                  +
       |                               |                               |                               |        | 
(5 rows)

Upvotes: 0

Views: 2741

Answers (1)

Craig Ringer
Craig Ringer

Reputation: 324471

It is 100% safe to just restart postgres with vacuum running. This is true for VACUUM, VACUUM (FULL), CLUSTER, etc.

It won't even have to restart the work completely at the beginning, it can keep some of the work done before the restart.

Upvotes: 3

Related Questions