The query came in. Production was fine until it wasn’t. The fix? A single new column.
Adding a new column to a database table is easy to describe but tricky to execute without risk. In modern systems, schema changes can stall deployments, lock tables, and slow queries if not planned. The key is to make the change compatible, fast, and observable.
First, define the new column with a default value that minimizes locking. Avoid large backfills during peak traffic. If you must backfill data, do it in batches and monitor I/O load. Use NULL defaults when possible to prevent rewriting the entire table.
Second, roll out the new column in phases. Deploy the schema migration separately from the application code that writes to it. This ensures backward compatibility and lets you revert without losing uptime.