Adding a new column to a database is one of the most common schema changes, but it is rarely trivial on large, production systems. The wrong move can lock tables, stall writes, or corrupt data. The right move keeps downtime at zero and performance intact.
When you create a new column, start by understanding the storage engine. In Postgres, ALTER TABLE ADD COLUMN is fast if the column has no default value or constraint. In MySQL with InnoDB, certain operations still require a full table copy. Know the cost before you run it.
For wide tables or high-traffic systems, adding a new column with a default can be dangerous. Instead, add it as nullable, then backfill in controlled batches. This avoids long locks and blocking reads. Use tools like pt-online-schema-change, gh-ost, or native online DDL to migrate without downtime.