The query returned in under 60 milliseconds, but something was wrong. The dataset had grown, and the schema no longer matched the code. You needed a new column.
Adding a new column is one of the most common database changes, yet it can be the most dangerous in production. A single schema migration can lock tables, stall transactions, and cause downtime. When handling terabytes of data, speed and safety matter.
First, decide whether the new column will be nullable. Adding a non-nullable column with a default can trigger a full table rewrite. On Postgres, that means locks that block writes. On MySQL, it depends on the storage engine and version. Nullable columns can be applied instantly in many cases, reducing risk.
Second, plan the migration in stages. Create the new column without constraints. Backfill data in controlled batches. Validate with application-level checks. Only then enforce constraints or indexes. This minimizes impact on live traffic.