Adding a new column is one of the most common schema changes. Done wrong, it can lock tables, block writes, and take down production. Done right, it’s fast, safe, and invisible to users.
Before adding a new column, scan the table size and traffic patterns. In high‑traffic systems, even a single ALTER TABLE can cause heavy locks. For large datasets, use online schema change tools like pt‑online‑schema‑change or native database features such as PostgreSQL’s ALTER TABLE ... ADD COLUMN with defaults applied in a separate step. This reduces lock times and avoids rewriting the entire table.
Always define the column’s nullability and default values explicitly. Implicit defaults can behave differently across databases and versions, creating hidden bugs. If adding a NOT NULL column, first add it as NULL, backfill in batches, then enforce the constraint.