Adding a new column sounds simple. In production, it’s not. Schema changes can lock tables, block reads, and stall writes. On large datasets, a migration can take hours. During that time, every dependent system slows down.
The safest approach starts with understanding your database engine. In PostgreSQL, ALTER TABLE ADD COLUMN can be instant for nullable columns with defaults set to NULL. But adding a non-null column with a default value can trigger a table rewrite. MySQL and MariaDB behave differently; older storage engines rewrite the whole table for nearly any ADD COLUMN operation, while newer versions support instant adds under certain constraints.
Plan the change. Create the new column as nullable first. Backfill in controlled batches to avoid locking or high replication lag. When backfill completes, set constraints and defaults. Use migration tooling that can pause, resume, and report progress.
If you run distributed systems, remember that a new column in one service’s database schema can break another service’s assumptions. Update ORM models and API contracts in sync with the schema change. Deploy code that can handle the old and new schema before running the migration. Only remove backward compatibility after the change is complete everywhere.