Adding a new column should be simple. In practice, it can risk downtime, break migrations, and create race conditions. The right approach depends on database size, load, and schema drift.
In SQL, the ALTER TABLE statement is the core tool. A straightforward ALTER TABLE ADD COLUMN works for small tables in low-traffic environments. On large, production datasets, that same command can lock the table and block writes. For PostgreSQL, ADD COLUMN without defaults or constraints runs fast, but adding a default value retroactively will rewrite the entire table. MySQL behaves differently—ADD COLUMN usually locks writes unless using ONLINE DDL in newer versions.
Schema migrations need careful planning. Deploy the new column before populating it. Backfill in batches to avoid long transactions. Add indexes only after data is in place to minimize locking. If you need constraints, apply them after backfill to reduce impact. Always test migrations in a staging environment with a dataset that mirrors production size and shape.