The migration halted. Everyone stared at the schema diff on the screen. A new column had appeared in the table definition, and nothing else could move forward until it was done right.
Adding a new column is one of the most common schema changes in production databases. It looks simple. It can destroy performance if you do it without planning. The right method depends on the database engine, the data type, the default values, and the indexing strategy.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast if the column is nullable without a default. The database only changes the metadata. If you add a column with a default value, PostgreSQL writes to every row. That can lock the table and block queries. In MySQL, especially older versions, adding a column can rewrite the entire table. Modern versions with ALGORITHM=INSTANT avoid the rewrite in many cases. Always check the specific version’s capabilities before running the command.
For production systems, the safest pattern to add a new column is: