Zero-downtime database migrations

Part 2: The index we were missing

The slow page ran eleven queries, and one of them scanned the whole table on every request. The query plan said so in plain words; we had simply never asked.

  • Read the query plan before adding an index
  • Put the most selective column first
  • Make every migration idempotent
  • Back up before, verify after

5 comments on “Zero-downtime database migrations”

    1. Elin Sørensen

      Good question. It took about three weeks, most of it waiting for review and measuring the results.

  1. Luis Ortega

    Bookmarked. The part about writing things down before changing anything is underrated.

  2. Clara Lindqvist

    This matches our experience almost exactly, down to the part where the slow tail took longest to fix.

Leave a comment

Your email address will not be published. Required fields are marked *