Adding a new column sounds trivial. It’s not. In production, a schema change can stall deployments, block queries, or lock tables when traffic spikes. Knowing the right way to add a column means balancing performance, safety, and rollback options.
A new column changes the shape of your data. You need to confirm defaults, constraints, and nullability before applying the change. In PostgreSQL, ALTER TABLE ... ADD COLUMN is straightforward, but adding with a default non-null value rewrites the table. On large tables, this can mean seconds or even minutes of locks unless you break it into steps. First, add the column as nullable. Then backfill in small batches. Finally, set constraints. MySQL behaves differently, with ALTER TABLE often causing a table copy unless using ALGORITHM=INPLACE when supported.
In distributed systems, the timing matters more. Deploy the code that can handle both old and new schemas before adding the column. This ensures backward compatibility during rolling updates. Avoid dropping or renaming during the same deployment as an add—those are separate operations with separate risks.