Adding a new column to a production database is one of the most common schema changes—and one of the most dangerous if handled poorly. The cost isn’t just the ALTER statement. It’s the lock time, migration strategy, replication lag, and downstream code impact. When done without a plan, it can slow queries, block writes, or even take the system down.
The first step is choosing the right method. In relational databases like PostgreSQL and MySQL, adding a nullable column without a default is usually instant. Adding a column with a default value, however, can rewrite the entire table. This can lock every row, consuming memory and I/O, and break SLAs. Use database-specific features like ADD COLUMN ... DEFAULT with metadata-only changes when possible.
For large datasets, run schema changes in two phases. First, add the column as nullable with no default. Then backfill the data in small batches, avoiding long transactions and write amplification. After backfill completion, enforce constraints and add indexes. This minimizes blocking and reduces risk.