Adding a new column to a database table is one of the most common schema changes, but it can bring production systems to their knees if done without care. Schema migrations run in live environments must be planned to avoid locking tables, blocking writes, or causing downtime. A single ALTER TABLE can halt high-traffic services if it runs unbounded.
The safest path starts with understanding the database engine. In PostgreSQL, adding a nullable column with a default can rewrite the entire table. MySQL handles some operations instantly, but others trigger full table copies. Know the difference. Always check your version-specific behavior before you touch production.
For high-scale systems, break the migration into stages. First, add the new column as nullable without a default. This avoids locking large datasets for extended periods. Next, backfill data in controlled batches to keep load predictable. Only after backfill completion should you set the default and enforce constraints.