The query finished running, but now the table needs a new column. You know the cost. Schema changes in production can freeze traffic, lock rows, and trigger cascading failures if they’re not controlled. Still, you can’t move forward without it.
Adding a new column sounds simple, but in high-load systems it can be dangerous. The actual operation depends on both the database engine and the size of the dataset. In PostgreSQL, ALTER TABLE ADD COLUMN is usually fast if you add a nullable column without a default. MySQL supports ALTER TABLE ADD COLUMN but may rewrite the table depending on the storage engine. On massive datasets, this rewrite can cause long locks and latency spikes.
The safest path is to design the migration plan and measure execution time before running it in production. Always test on a replica or staging environment with production-like data volume. In many systems, backfilling data after the column exists will be less risky than adding the column with a default value. Split that backfill into small transactional batches to reduce write pressure.