Adding a new column is one of the most common schema changes. It looks simple, but in production, the wrong approach can lock queries, spike load, and cause downtime. The goal is to make the change safely, quickly, and without disrupting traffic.
At the SQL level, ALTER TABLE is the standard tool. But with large datasets, a blocking ALTER TABLE ADD COLUMN can halt writes. Use non-blocking operations when possible, such as ADD COLUMN with DEFAULT NULL and updating rows in batches. Avoid setting a NOT NULL constraint with a default during the initial add—it can rewrite the entire table and impact performance.
Schema migrations should run in controlled steps. First, add the column in a way that does not cause a full table lock. Second, backfill data in manageable chunks. Finally, apply constraints or indexes once the data is in place. This process allows the system to continue serving traffic while progressing toward the final structure.