The migration halted. Everyone stared at the schema diff. A new column had appeared in the production database, unplanned and unexplained.
A new column changes everything. In SQL, adding a column to a table is not just metadata—it shifts storage, queries, and sometimes index strategies. In PostgreSQL, ALTER TABLE ADD COLUMN is fast for nullable additions, but defaults with non-null constraints can trigger costly table rewrites. In MySQL, the exact cost depends on the storage engine; InnoDB may lock the table during structural changes unless using ALGORITHM=INSTANT.
When you add a new column, think beyond syntax. You must assess:
- How will the ORM map it?
- Will existing queries break if
SELECT *is used? - Does replication lag spike during DDL execution?
- Do you need to backfill historical data, and will that block write operations?
Schema versioning tools like Liquibase, Flyway, or native migration frameworks in Rails and Django handle adding columns, but you still need to read the generated SQL. Review execution plans after adding a column—optimizers may shift join strategies based on column statistics.