Adding a new column in a production database is never trivial. The wrong move can lock tables, cause latency spikes, or corrupt live data. Choosing the right approach depends on the database engine, traffic patterns, and migration strategy.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast for nullable fields with default NULL, but adding a column with a default value rewrites the whole table. Use ALTER TABLE ... ADD COLUMN ... DEFAULT only if the dataset is small or traffic is light. For large tables, add the column as nullable, then backfill in controlled batches. Once backfilled, set the NOT NULL constraint in a quick metadata update.
In MySQL, adding a column may trigger a full table rebuild in older versions or incompatible storage engines. Newer versions with ALGORITHM=INSTANT can add columns instantly under certain conditions. Always confirm with SHOW VARIABLES LIKE 'innodb_version' and read the release notes before relying on instant DDL.