Adding a new column to a database table is simple in theory but dangerous in practice. The wrong step can lock tables, block writes, or trigger cascading errors across services. In large systems, schema changes must be handled with precision, speed, and rollback readiness.
The first decision: online or offline migration. For small, low-traffic tables, a standard ALTER TABLE ADD COLUMN may finish instantly. On production systems under load, that same command can block queries for minutes or hours. Online schema change tools like pt-online-schema-change or gh-ost can add a new column without locking the table, but they require careful configuration.
Second, define defaults and constraints. Adding a nullable column is fast, but may open the door to inconsistent data if writes skip it. Adding a column with a default value in one step can be slow, as the database must rewrite every row. Many teams add the column as nullable, backfill data in batches, then enforce NOT NULL later. This minimizes locking and release risk.