Adding a new column sounds simple—ALTER TABLE ADD COLUMN—but the real work is in the execution. Schema changes on production databases must respect live traffic, preserve data integrity, and avoid locking tables for unacceptable durations. Large datasets make this harder. A blocking migration can stall writes, cause timeouts, and trigger cascading failures across services.
Best practice is to use an online schema change strategy. Create the new column in a way that avoids full table locks, backfill incrementally, then switch application logic to use it. For MySQL, tools like pt-online-schema-change or gh-ost are common. For PostgreSQL, consider ADD COLUMN with a default null, then update in batches. Always test on production-like data before running live.
Plan the deployment as part of a controlled release. Monitor query plans, replication lag, and error rates. If you have multiple services reading and writing to the same table, coordinate rollouts so old and new code paths can run together. Use feature flags to control when the new column becomes active.