79710662

Date: 2025-07-22 14:53:11
Score: 1
Natty:
Report link

PostgreSQL autovacuum takes a ShareUpdateExclusiveLock on a database table, and gets cancelled when it comes across a DDL statament like ALTER etc (which takes an Access Exclusive Lock). In case you are thinking that autovacuum would affect DDL statement then that is not the case; once deadlock_timeout (default 1s) is reached, the vacuuming would get cacnelled and the DDL statement would get executed.

Other DML statements or SELECT queries do not get affected by autovacuum.

However, in case autovacuum is running in anti-wraparound mode, your DDL statements may get blocked since this kind of autovacuum does not back off. In case you have DDL statements getting frequently run on a particular table, you can turn off autovacuum for that table.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Yashodhan Agnihotri