~/talk

Common Possible Preventative Measures to Avoid Locking Issue in PostgreSQL

Talkat Percona Community Live 2022 · 2022-06-21..06-23· [databases]
links:none on file
slides:none on file

Main concrete rules: before PostgreSQL 11 adding a column with a DEFAULT rewrites the whole table and can block reads and writes for hours so avoid defaults on ALTER TABLE and instead add the column then UPDATE in small batches; always CREATE INDEX CONCURRENTLY to prevent write blocking; use set lock_timeout so DDL fails fast instead of piling into lock queues; minimize aggressive locks by populating a new table then RENAME and prevent deadlocks by ensuring transactions acquire row locks in a consistent order.

AI-written summary · about

  1. 0:00Introduction
  2. 1:09Golden rule for columns
  3. 4:25Lock queues and timeouts
  4. 6:33Create indexes concurrently
  5. 8:19Delay aggressive locks
  6. 9:44Order commands to avoid deadlocks
  7. 12:10Q&A
~/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.