Code RoomMigration holding exclusive lock
HardPrep Room Coding #2946

Migration holding exclusive lock

On-callDatabases & SQLConcurrencySenior–Staff~40 min

A deploy at 11:00 ran a schema migration that's now blocking the whole app. The migration does `ALTER TABLE orders ADD COLUMN status_v2 text NOT NULL DEFAULT 'pending'` followed by a `CREATE INDEX` on a 150M-row Postgres table — and it's running inside the deploy's migration step. Since it started, all reads and writes to `orders` hang; `pg_stat_activity` shows the migration holding an `AccessExclusiveLock` on `orders`, and behind it a growing queue of normal app queries all "waiting for lock," including simple SELECTs. The app is effectively down for anything touching orders. The migration has been running 6 minutes with no end in sight. Triage and decide.

What a strong answer looks like

Stop the bleeding first (mitigate), then form hypotheses from real signals. Separate root cause from symptom, communicate status as you go, and close with what prevents a repeat.

0:00 of about 40 min
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.