Jaywalking in Traffic: Safe Migrations at Scale


At scale, easy things become hard. Database migrations for web applications are particularly perilous when performed under heavy load. Join us as we discuss migration strategies for non-downtime deployments. We'll cover the fundamentals of Postgres locking and how it can block requests and crash your app. Using real life examples from a highly trafficked web app, we'll see what types of schema changes cause locking and what techniques can be used to circumvent it. We'll cover:


  • Splitting a single migration into many to avoid locking pitfalls

  • Using temporary indexes to speed up updates

  • Dividing migrations into phases to solve web framework schema caching issues

  • Batching updates to minimize lock contention

  • Automatically managing lock timeouts

  • Migration tooling for Ruby on Rails and similar frameworks


Regardless of the scale you run at, you'll learn plenty of value about Postgres, locking, and safely altering schemas. You'll get a comprehensive list of changes you can and cannot make under load to inform your migration strategy. Learn these techniques, tips and tools for safe migrations and avoid catastrophe next time your team deploys.

Room 107
Friday, March 3, 2017 - 14:00 to 15:00