Adding a new column is one of the most common database changes, yet it can cause downtime, data loss, or performance hits if done carelessly. The process is simple in concept, but the execution depends on the database engine, schema complexity, and workload.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast if the column has no default value and allows nulls. When you set a default or NOT NULL constraint, the database must touch every row, which can lock the table for long periods. This can be avoided by adding the column as nullable, backfilling in controlled batches, then altering constraints after data is in place.
In MySQL, adding a new column may trigger a table rebuild, depending on the storage engine and version. Online DDL options (ALGORITHM=INPLACE) can reduce lock time, but not all changes qualify. Always check execution plans and schema changes on a staging database before production rollout.