Adding a new column is one of the most common schema changes in modern systems. It seems simple—one ALTER TABLE, a quick deploy—but downtime, lock contention, and migration errors can turn it into a production incident. Planning and executing the change with precision matters.
A new column can store fresh data, enable new features, or restructure old patterns. But the way you add it depends on table size, indexes, and query load. For small tables, a single migration step may be safe. For large tables, online migrations are essential. Tools like pg_online_schema_change for PostgreSQL or gh-ost for MySQL reduce locking and avoid blocking writes.
Default values on a new column can be expensive, since backfilling data locks rows or burns I/O. Adding the column as NULL, then backfilling in batches, cuts impact. Once data is backfilled, constraints or defaults can be added in a second migration. This two-step approach limits the blast radius of mistakes.