0

Is there a way to cancel an automatic vacuum in rds postgresql? When running

  • select pg_cancel_backend(...);
  • select pg_terminate_backend(...);

with a user that has the rds_superuser role an error occurs:

  • ERROR: must be a superuser to cancel superuser query
  • ERROR: must be a superuser to terminate superuser process

1 Answer 1

0

rds_superuser is not a superuser.

You should not cancel autovacuum, it is doing an important job for the integrity of your database. But unless it is an anti-wraparound autovacuum run, you can make it die with a conflicting lock:

BEGIN;
SET LOCAL lock_timeout = '2s';
LOCK table_being_vacuumed IN SHARE UPDATE EXCLUSIVE MODE;
ROLLBACK;

Normal autovacuum runs die if they block a user session for more than a minute. There is nothing you can do about anti-wraparound autovacuum runs.

Your Answer

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

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