~/talk

rails db:migrate:safely

Talkat RailsConf 2019 · 2019-05-01..05-03· [databases, ruby-on-rails]
slides:none on file

If a migration will touch tens of millions of rows this shows exactly what to do and what breaks: adding a column with a default triggers table locks, backfilling inside the implicit transaction blocks traffic for minutes, and a dropped/added index done wrong causes a 45‑minute outage. Concrete fixes include disable_ddl_transaction! and batched updates (example batch size 2000), using CREATE INDEX CONCURRENTLY on Postgres, testing with APM/Little’s Law in mind, and tooling like strong_migrations or zero_downtime_migrations.

AI-written summary · about

  1. 0:00Start
  2. 4:25UNDER THE HOOD LOCKS
  3. 7:46DON'T ADD COLUMNS WITH A DEFAULT VALUE.
  4. 9:58UNDER THE HOOD TRANSACTIONS
  5. 17:32DON'T BACKFILL DATA INSIDE A TRANSACTION.
  6. 19:40DON'T MIX SCHEMA AND DATA CHANGES.
  7. 23:18DO ADD POSTGRES INDICES CONCURRENTLY.
  8. 23:44CASE STUDY AUDITS
  9. 26:23UNDER THE HOOD CONCURRENCY
  10. 29:24AUDITING OVERVIEW BUT ACCURATE THIS TIME
~/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.