The database was live, traffic was climbing, and the schema needed to change. You had to add a new column—fast. No downtime, no broken queries, no errors in production.
Adding a new column sounds simple. In practice, it is one of the most common points of friction in evolving systems. Schema migrations can lock tables, trigger replication lag, or cause incompatible state across services. These issues scale with dataset size and query load.
A new column in PostgreSQL, MySQL, or any SQL database should be planned with precision. Check for default values that require the database to rewrite the entire table. Use nullable defaults or backfill rows in batches to avoid long locks. If columns are computed or indexed, create them separately to reduce transaction time.
For large deployments, coordinate application code changes with the schema update. Ship code that writes to both old and new columns before reading from the new column exclusively. This pattern allows you to verify correctness before cutting over.