Adding a new column sounds simple. It isn’t. Schema changes can lock tables, block writes, and bring down critical services. For production systems, a new column must be planned, staged, and executed with zero downtime. That means understanding the database engine’s execution path, the cost of backfilling data, and the effect on indexes.
In PostgreSQL, adding a column without a default value is instant. Adding one with a non-null default rewrites the table and can freeze I/O on large datasets. MySQL behaves differently depending on the storage engine and column type. Some changes can be “instant” in recent versions, while others still require a full table copy. Always check the exact behavior for the version in production.
To deploy a new column safely, use an additive migration. First, create the column as nullable with no default. Let this change roll out. Then, backfill data in small batches to avoid saturating I/O. Finally, enforce constraints and set defaults in a separate migration once the data is in place.