Adding a new column is one of the most common schema changes in any database. It looks simple, but it can break production if you do it wrong. The method you choose depends on your engine, your dataset size, and your uptime requirements.
In PostgreSQL, ALTER TABLE ADD COLUMN is the direct path. By default, it’s fast for nullable columns without defaults—Postgres will only update the table definition. But add a DEFAULT with NOT NULL and it rewrites the whole table, locking writes and slowing reads. For large datasets, use a nullable column first, backfill in batches, and then apply constraints.
In MySQL, the behavior depends on the storage engine and version. InnoDB in modern releases can add nullable columns instantly for some data types. For older versions, adding a column often copies the table, which can take hours and block queries. Always check ALGORITHM=INPLACE or ALGORITHM=INSTANT where supported.
For distributed databases like CockroachDB or YugabyteDB, schema changes can be online by default, but still create load. Monitor node performance while the change propagates.