PostgreSQL Lock Conflicts

Database engineering course | @hnasr |

AccessExclusiveLock

The AccessExclusiveLock lock is a Table lock. This list shows the commands that acquire AccessExclusiveLock and what locks conflicts with it.

The following commands acquire AccessExclusiveLock Table lock

  1. VACUUM FULL
  2. TRUNCATE
  3. REINDEX
  4. REFRESH MATERIALIZED VIEW
  5. DROP TABLE
  6. DROP INDEX
  7. CLUSTER
  8. ALTER TABLE SET/DROP DEFAULT
  9. ALTER TABLE SET TABLESPACE
  10. ALTER TABLE SET STORAGE
  11. ALTER TABLE SET SEQUENCE
  12. ALTER TABLE SET DATA TYPE
  13. ALTER TABLE SET COMPRESSION
  14. ALTER TABLE RESET STORAGE
  15. ALTER TABLE RENAME
  16. ALTER TABLE INHERIT PARENT
  17. ALTER TABLE ENABLE/DISABLE RULE
  18. ALTER TABLE ENABLE/DISABLE ROW LEVEL SECURITY
  19. ALTER TABLE DROP EXPRESSION
  20. ALTER TABLE DROP CONSTRAINT
  21. ALTER TABLE DROP COLUMN
  22. ALTER TABLE DETACH PARTITION (PARENT)
  23. ALTER TABLE DETACH PARTITION (TARGET/DEFAULT)
  24. ALTER TABLE DETACH PARTITION CONCURRENTLY (TARGET/DEFAULT)
  25. ALTER TABLE ATTACH PARTITION (TARGET/DEFAULT)
  26. ALTER TABLE ALTER CONSTRAINT
  27. ALTER TABLE ADD COLUMN
  28. ALTER TABLE ADD CONSTRAINT
  29. ALTER INDEX SET TABLESPACE
  30. ALTER INDEX SET FILLFACTOR
  31. ALTER INDEX ATTACH PARTITION

The following are table locks conflicting with AccessExclusiveLock

  1. AccessShareLock
  2. RowShareLock
  3. RowExclusiveLock
  4. ShareUpdateExclusiveLock
  5. ShareLock
  6. ShareRowExclusiveLock
  7. ExclusiveLock
  8. AccessExclusiveLock