Adding a new column sounds trivial until it breaks production. Schema changes touch live data. They change indexes, query plans, memory layouts. They can block writes. They can cause silent data corruption if done wrong. The right way to add a new column depends on your database engine, your dataset size, and your uptime constraints.
In PostgreSQL, adding a new column without a default is usually fast. Adding one with a default and NOT NULL rewrites the entire table. That’s a problem on large datasets. The workaround is to add the column as nullable, backfill data in small batches, then apply constraints. MySQL behaves differently—ALTER TABLE may lock the table depending on your storage engine. With InnoDB, online DDL options help, but not for every case.
Migration safety means rehearsing changes, reviewing DDL, and running them in non-peak hours—or better, online. Tools like Liquibase, Flyway, or native ALTER TABLE wrappers can automate pattern-safe sequences. Feature flags let you deploy application code that can handle both old and new schemas, then flip over once the backfill completes.