Adding a new column sounds trivial. It isn’t. Schema changes are high‑risk in live systems. Done wrong, they cause locks, downtime, or data loss. Done right, they are invisible and fast.
When you add a new column, you change the shape of the data your code depends on. The first step is to decide the column name, type, and constraints. Avoid default values on large tables during creation; they trigger full table rewrites. Add the column as nullable first. Then backfill in small batches to limit load on the database. After verification, apply defaults or NOT NULL constraints in a separate step.
For zero‑downtime changes, the approach depends on the database. In PostgreSQL, ALTER TABLE ADD COLUMN with a nullable field is near‑instant. In MySQL, use ALGORITHM=INPLACE when possible. Test the migration on a replica or staging environment with realistic data sizes. Monitor execution time, locks, and replication lag.