Adding a new column should be simple, but in production it’s often a high‑risk, high‑pressure event. Schema changes can lock up writes, block critical requests, or silently corrupt downstream jobs if deployed without care. The safe path depends on the database, the scale, and the release process.
In SQL databases, the ALTER TABLE ADD COLUMN command is the starting point. For small tables, it runs fast. For large datasets, it can trigger full‑table rewrites or lock the table for long stretches. Many teams avoid direct alterations and instead use phased rollouts. First, add the new column as nullable. Deploy the application code to support both old and new schema versions. Backfill data in small, transaction‑safe batches. Once the column is complete and verified, enforce constraints and defaults.
In PostgreSQL, adding a nullable column without a default is nearly instant, since only the metadata changes. Adding a column with a default value can be slow if it rewrites the table, unless you use the DEFAULT + NOT NULL pattern in multiple steps. In MySQL, especially older versions, even simple changes can block writes unless ONLINE DDL features are enabled.