Adding a new column should be fast, safe, and predictable. In high-traffic databases, even a single schema change can block queries, lock tables, or cause downtime. The key is to design the migration process so it works online, scales with production load, and doesn’t rewrite entire tables.
Use ALTER TABLE with care. In PostgreSQL, adding a new column with a default value rewrites the whole table—this can stall your system for hours on large datasets. Instead, add the column without defaults, then backfill data in batches. This avoids heavy locks and keeps reads and writes flowing. MySQL and other engines have similar constraints; check their documentation before running changes.
Plan for indexing early. Adding an index after data has grown can be expensive. If the new column will be queried often, decide whether to index it immediately or wait until after the backfill. Use concurrent index creation where supported to prevent blocking.