The query finished running, but the data didn’t match the plan. You needed a new column, and you needed it without breaking production.
Adding a new column is a common schema change, but it’s where many systems fail under load. Schema migrations can lock tables, bloat indexes, and stall queries. If you deploy without care, you can cause downtime, data drift, or worse — silent corruption.
The first step is to define the column with the correct data type and constraints. Avoid defaults that trigger full table rewrites. When possible, make the column nullable during creation to bypass immediate writes on existing rows.
For large datasets, use an online migration tool. These tools break the change into small batches, add the new column in a non-blocking way, and backfill data incrementally. This approach minimizes locks and keeps read and write paths clear.