Adding a new column sounds simple. In production, it can get messy. Schema changes can lock tables, slow queries, or break downstream services. Done wrong, a single ALTER TABLE can push latency through the roof. Done right, it’s invisible and safe.
The first step is knowing your database’s limits. In Postgres, ALTER TABLE ADD COLUMN is fast if you skip defaults. In MySQL, adding a column to a large table can trigger a full table rewrite. Use NULL with no default for instant changes, then backfill in small batches. Avoid locking reads and writes under load.
Plan the rollout. Update the schema in one migration, handle data backfill separately, then deploy code that uses the column. This prevents race conditions and lets you roll back in stages. Always test migrations against production-sized datasets. Use replicas to simulate real load.