Adding a new column sounds simple. In production, it can be risk. Schema changes can lock tables, block writes, or cause downtime. The impact grows with table size, replication lag, and how your database engine handles DDL.
Start by defining the column. Decide on type and nullability. Avoid adding non-null columns with default values in a single blocking operation if the table is large. Many relational databases will rewrite the full table in that case, which can take minutes or hours.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast for nullable additions without defaults. MySQL’s behavior depends on version and storage engine; InnoDB can handle many adds without full table copies in recent releases. Test in a staging environment with a realistic dataset.
For zero-downtime schema changes, break them into steps. First, add the new column as nullable. Then backfill in small batches to avoid load spikes. When the data is ready, set constraints or defaults. Use transactions and locks only where safe.