The database table was running hot, and a single feature request threatened to slow the entire release. The fix was simple: add a new column. The challenge was doing it without downtime, corruption, or breaking production code.
Adding a new column should be routine, but scale, traffic, and schema complexity can turn it into a critical operation. A careless migration can cause full table rewrites, lock queries for minutes, or blow up caches. The right approach depends on your datastore, your constraints, and your deployment strategy.
In PostgreSQL, adding a new column without a default is fast and metadata-only. Adding a column with a default triggers a table rewrite in versions before 11. To avoid blocking, create the column first as NULL, then backfill in batches. In MySQL, adding columns often involves a full table copy unless you use pt-online-schema-change or native ALGORITHM=INPLACE on supported engines. With cloud-managed databases, confirm the platform's behavior and test migrations against a snapshot before touching production.