Adding a new column seems trivial—until production has a million rows and zero downtime is required. The choice between an online schema change, a background migration, or a hot alter can make or break your release. The right approach depends on your database engine, your data distribution, and your tolerance for risk.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast if you add a nullable column with no default. The command updates the catalog instantly, avoiding a full table rewrite. But add a default, and Postgres writes to every row, locking the table until it finishes. In MySQL, ALTER TABLE can still be dangerous on large datasets unless you use tools like pt-online-schema-change or built‑in online DDL features in newer versions.
When you must populate data in the new column, consider backfilling in batches. Run the migration first to add the empty column. Then use background jobs to fill it without locking the table. Track progress and throttle your writes to protect performance.