Adding a new column should be simple. In production, it often isn’t. Schema changes can lock tables, block reads, or cause downtime. On massive datasets, a naïve migration can trigger hours of degraded service. The goal is zero downtime, but that requires precision.
A new column changes the shape of your data. You must decide on the data type, default values, constraints, and indexes. Every decision affects performance. For large tables, adding a default can rewrite the entire table, saturating I/O. Dropping the default at creation and backfilling in batches can avoid this.
Plan the migration in stages. First, add the column as nullable with no default. Then, write a backfill job to populate values in small chunks, using indexed ranges or primary keys to batch updates. Finally, add constraints or indexes after the data is complete. Each step reduces lock time and load on the database.