Adding a new column should be simple, but scale makes it brutal. Databases choke on blocking ALTER TABLE commands. Locks cascade. Latency spikes. Customers notice. This is why a “new column” in a large, live system demands a plan built for zero downtime.
The safest pattern avoids full table rewrites. First, create the column with a nullable default, so the operation is instant. Second, backfill in small batches to avoid locking. Third, enforce the NOT NULL or default values only after the data is in place. This phased approach removes risk while keeping the system online.
For PostgreSQL, ALTER TABLE ... ADD COLUMN with no default is near-instant. Use UPDATE ... WHERE with LIMIT and indexed filters to backfill. Monitor write amplification; batch size should match replication lag thresholds. In MySQL, ALTER TABLE ... ADD COLUMN with ALGORITHM=INPLACE can reduce lock times, but test against your version’s behavior and storage engine.