Anatomy of table level locks in Postgresql
summary
Explains that PostgreSQL uses MVCC with xmin/xmax row versions so reads and writes usually don’t block but DDL often needs access exclusive locks that block selects and create cascading queues; recommends setting lock_timeout, never mix DDL and DML in one transaction, and break heavy ALTERs into steps (add nullable column, batch-update, then set NOT NULL) or use NOT VALID check constraints then validate. Shows real benefits of CONCURRENTLY and describes an open-source tool pgroll that implements expand/contract migrations, batched backfills, retries and easy rollback.
AI-written summary · about
