Lessons from Zero-Downtime Postgres Migrations That Nearly Took Prod Down
dev.to·3d·
Discuss: DEV
🚚Data Migration
Preview
Report Post

The migration was supposed to be routine. Add an index, update some constraints, deploy the new application code. Zero downtime, zero risk. We’d done this dozens of times.

Then at 2:47 PM on a Wednesday, our production database locked up. API response times spiked from 50ms to 30 seconds. User sessions started timing out. The queue of pending requests grew exponentially. Within ninety seconds, our entire platform was effectively down.

The migration was still running. The index creation we thought would take two minutes had been holding an exclusive lock for three minutes and counting. Every query waiting for that lock was blocking other queries. The cascade failure was complete.

We had to make a choice: kill the migration and restore service, or wait for it to complete and …

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help