Adding a new column sounds trivial. It isn’t. In production databases with live traffic, schema changes can lock tables, block writes, or even take your app down. How you add a new column depends on engine, load, and your tolerance for risk.
In PostgreSQL, a simple ALTER TABLE ADD COLUMN runs fast for metadata-only additions when you provide a default of NULL. But adding a default value forces a rewrite of the entire table unless you use DEFAULT with NOT NULL and then backfill in batches. Use CREATE INDEX CONCURRENTLY if you also need an index to avoid blocking queries.
In MySQL, adding columns can be instant with ALGORITHM=INPLACE or ALGORITHM=INSTANT in newer versions, but older versions require full table copies. Always check the execution plan with EXPLAIN before running migrations. On large datasets, test with a replica first.
If you work with distributed systems like CockroachDB or Vitess, online schema changes are part of the workflow. These systems replicate the DDL behind the scenes, but you still need to plan for schema drift and verify column propagation before deploying new application logic.