You need to add a column to a table with 100 million rows. Old approach: Lock the table, add column, wait 30 minutes, production is down. New approach: Add column, backfill data, no downtime. The Pattern Step 1: Add column (new, nullable) ALTER TABLE users ADD COLUMN new_field VARCHAR ( 255 ) NULL ; Enter fullscreen mode Exit fullscreen mode Takes 2 seconds. Table briefly locked. No big deal. Step 2: Backfill in batches UPDATE users SET new_field = computed_value WHERE id >= 0 AND id < 10000 ; UPDATE users SET new_field = computed_value WHERE id >= 10000 AND id < 20000 ; -- ... repeat in batches Enter fullscreen mode Exit fullscreen mode Takes time but doesn't lock the whole table. Step 3: Add constraint (if needed) ALTER TABLE users MODIFY new_field VARCHAR ( 255 ) NOT NULL ; Enter fullscreen mode Exit fullscreen mode After backfill is done. Step 4: Update application Start writing to new_field. Step 5: Remove old code Once confident, stop reading old_field.…