The query ran. The screen froze. You needed a new column, and you needed it without breaking production.
Adding a new column to a live database sounds simple. It isn’t. Done wrong, it locks tables, stalls writes, and burns through your error budget. Done right, it happens in seconds, without downtime, without corrupting data, and without disrupting users.
First, know your table size. Schema changes scale poorly when size grows. A ALTER TABLE ADD COLUMN on a billion rows can lock the entire table. Many relational databases copy the whole structure during this change, which can hammer I/O and CPU.
Second, pick the right migration strategy. For PostgreSQL, use ADD COLUMN with a default that is NULL, then backfill in small batches. For MySQL, run the change with pt-online-schema-change or gh-ost to stream updates without blocking. Always test these operations in a staging environment with production-like data. Measure query plans and indexes before and after.