Adding a new column sounds simple—until it isn’t. In production, a careless schema change can choke a database, lock writes, or cause downtime you can’t afford. Safe changes require a plan, a process, and the right execution.
Start by defining the new column in a way that avoids heavy locks. Choose NULL defaults when possible, or backfill in batches. Avoid adding NOT NULL with a default on large tables in one step. Perform schema changes during low-traffic windows, but don’t rely on luck—test the migration on a staging copy with production-scale data.
For relational databases like PostgreSQL or MySQL, use ALTER TABLE with care. PostgreSQL can add a nullable column instantly; MySQL’s behavior depends on storage engine and version. Watch query plans after the change to ensure no regressions.