Adding a new column is one of the most common schema changes. Done wrong, it can lock tables, block writes, or cause deployment failures. Done right, it happens without downtime and without breaking consumers. The key is choosing the right migration path and understanding your database’s behavior under load.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast for null defaults because it only updates metadata. But adding a column with a non-null default rewrites the table, which can take minutes or hours on large datasets. MySQL behaves differently. With InnoDB, ADD COLUMN may be online in some cases, but complex types and foreign keys can force a full table rebuild.
When introducing a new column in production, deploy in stages. First, add the column as nullable without defaults. Backfill data in small batches, avoiding long transactions. Once backfill is complete, update constraints and defaults in a second migration. This reduces lock contention and keeps application requests flowing.