How a non-concurrent index on 40M rows silently killed writes for 11 minutes
A routine database migration at an unnamed company caused an 11-minute write outage on a Wednesday morning when a non-concurrent CREATE INDEX on a 40-million-row orders table collided with a long-running analytics query, triggering Postgres's lock-queuing behavior. Because migrations ran inside the application's startup path, pods could not serve traffic during the incident, and rolling back the deploy offered no safe escape from the partially built index. The team had no choice but to wait out the lock. In response, the engineering team decoupled migrations from application deploys, making schema changes a separate pipeline stage run before code is released. They also adopted lock and statement timeouts, mandatory use of CREATE INDEX CONCURRENTLY, and an expand-and-contract policy ensuring all schema changes remain backwards compatible with the currently running code.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in