The schema was brittle. One more deploy and the queries would break. The fix was simple: add a new column. The risk was not.
Adding a new column to a database table can be painless or it can stall production. The details matter. Which database engine. Existing data volume. Locks. Transaction overhead. The difference between a smooth migration and an outage lies in preparation.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast for empty columns with defaults of NULL. Adding a new column with a default value that is not NULL rewrites the entire table. That means locking every row until it finishes. In MySQL, the version and table type determine if the operation is instant or if it copies the table. Using ALGORITHM=INPLACE can avoid downtime, but not for every change.
For large datasets, run the migration in a controlled rollout. Break schema changes into steps. First, add the new column as nullable with no default. Load and backfill data in batches. Then enforce constraints. This approach removes long locks and reduces risk.