A new column changes the shape of your data. It can add capabilities, fix gaps, or prepare for features ahead. But in real systems, adding columns is never just a DDL command. Schema migrations touch database performance, replication lag, index strategies, and application code.
When you add a new column in SQL, most engines require a table rewrite if the column has a default value or a complex type. This can block writes or degrade performance. On large tables, the migration must be planned:
- Use
NULLcolumns first to avoid costly rewrites. - Apply defaults in application logic instead of the schema when possible.
- Break changes into steps: create column, backfill data, then enforce constraints.
Concurrency matters. A long-running ALTER TABLE can lock rows and slow queries. In PostgreSQL, adding a column with no default and NULL values is fast because it doesn’t rewrite data. In MySQL, the algorithm choice (INPLACE vs COPY) controls whether the migration blocks reads and writes.