The query returned without warning: add a new column. No downtime. No broken builds. Just a schema that adapts while the system runs at full speed.
A new column in a production database sounds simple, but the wrong approach can lock tables, stall writes, or crash critical services. The right approach is to design migrations that are fast, safe, and reversible.
Define the new column with clear defaults. Choose data types that balance precision with performance. Avoid operations that rewrite all existing rows in one transaction. Use backfill strategies that run in small batches to keep latency and CPU load stable.
For relational databases, create the column as nullable first. Deploy the schema change. Deploy code that uses the column in a non-critical path. Then backfill in controlled steps. Only make the column non-nullable when all rows are ready.