Adding a new column seems simple. It is not. In production, every schema change is a live-fire exercise. A careless ALTER TABLE can lock rows, stall writes, and cascade failures downstream. To do it right, you plan, measure, and execute with precision.
When adding a new column in PostgreSQL or MySQL, start with the smallest possible change. Avoid default values on large tables during ALTER operations; they rewrite every row. Make it nullable. Backfill in controlled batches. Then add NOT NULL constraints once the data is complete. This reduces lock time and protects availability.
For zero-downtime deployments, pair schema changes with code updates behind feature flags. First deploy code that can read and ignore the new column, then deploy code that writes to it, and finally enforce constraints. This staged rollout prevents mismatches between application code and database state.