The schema was clean. The migration was ready. Then the ticket landed: add a new column.
Adding a new column can be trivial or dangerous. It depends on the size of the dataset, the database engine, indexing strategy, and how the change is deployed. Done wrong, it locks tables, stalls queries, and causes downtime. Done right, it ships to production without a blip.
Start by understanding the engine’s ALTER TABLE behavior. In MySQL before 5.6, adding a column often involved a full table copy. On large tables, this means hours of lock time. Modern versions with ALGORITHM=INPLACE or ALGORITHM=INSTANT dramatically reduce that cost—but support depends on storage engine and column type.
In PostgreSQL, adding a new column with no default is almost instantaneous. The schema changes, but no data rewrite occurs. Add a default value, though, and the server writes to every row unless you’re on a version that supports metadata-only defaults. Always check version-specific release notes.