~/talk

Anatomy of Table-Level Locks in PostgreSQL

Talkat PGDay Lowlands 2025 · on Friday, 2025-09-12· [databases]
slides:none on file

Explains exact table-level modes like Access Share, Access Exclusive and shows how a 30-minute monthly SELECT can block an ALTER TABLE DETACH and queue dozens of simple reads behind one waiting DDL. Demonstrates practical fixes: use CONCURRENTLY where supported, split an ADD COLUMN NOT NULL DEFAULT into add column → batched UPDATE → VALIDATE CHECK USING NOT VALID then alter, and set lock_timeout. Describes the open-source tool pgroll using the expand/contract pattern to run migrations with overlapping schema versions and rollback capability.

AI-written summary · about

  1. 0:00Introduction and speaker intro
  2. 1:07Speaker background and motivation
  3. 6:28MVCC and PostgreSQL concurrency
  4. 12:28Why locking is unavoidable
  5. 13:52Focus on DDL locks
  6. 15:16Table lock modes overview
  7. 18:12How PostgreSQL lock queue works
  8. 20:59Lock contention example
  9. 23:32Simple techniques to reduce lock contention
  10. 27:44Breaking DDLs into smaller steps
  11. 31:35Modern PostgreSQL optimizations
  12. 33:22Introducing PG Roll tool
  13. 40:11PG Roll features and benefits
  14. 41:38Q&A and closing remarks
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.