Adding a new column to a production database sounds simple. It rarely is. Schema changes can lock tables, stall writes, and cause downtime if handled carelessly. Choosing the right approach—online migration, shadow writes, or batched updates—can mean the difference between zero downtime and a midnight outage.
Start with the design. Define the new column with the correct data type, constraints, defaults, and nullability from the start. Avoid heavy default backfills in one transaction. For large datasets, run iterative updates in small batches while the column exists but remains unused. Monitor performance during the backfill to avoid impacting query speeds.
If the database supports it, use features like ALTER TABLE ... ADD COLUMN with ONLINE=ON or its equivalent. For systems without native online DDL, create a migration plan. That often means: