Adding a new column to a database table sounds simple. In production, it is not. Schema changes affect performance, locking behavior, and live queries under load. A careless ALTER TABLE can slow the entire system or block writes. The right approach depends on the database engine, data volume, and uptime requirements.
For relational databases like PostgreSQL or MySQL, adding a new column without a default value is fastest. It updates only the system catalog and avoids rewriting rows. But when you need a default or a not-null constraint, the operation can become expensive. In PostgreSQL before version 11, this writes all rows, creating downtime for large tables. Later versions optimize this, but engine-specific limits still apply.
Non-blocking migrations require planning. Feature flags, background backfills, and phased rollouts mitigate risk. First, add the new column as nullable. Deploy application code that can handle both old and new schemas. Backfill data in batches. Then, once all rows have values, run a quick metadata-only update to enforce constraints.