Adding a new column is one of the most common schema changes in modern databases. It feels simple. It can be dangerous. Done well, it’s fast, safe, and clean. Done poorly, it can lock tables, block queries, and break production systems.
Why you add a new column
A new column usually carries new business logic: extra identifiers, new timestamps, tracking flags, or calculated values. Deciding to add it is trivial. Deciding how to add it without downtime is the real work.
Understanding the database engine
Every RDBMS handles DDL changes differently. In PostgreSQL, ALTER TABLE ADD COLUMN is instant if no default value is assigned. With a default and NOT NULL, the engine must rewrite the table, which can block reads and writes. MySQL can use in-place algorithms for some column additions, but older versions require full table copies.
Performance and locking
Schema changes are metadata changes until they trigger rewrites. Large datasets turn simple operations into long transactions. These can saturate I/O, impact replication lag, and trigger cascading failures. Always check execution plans and metadata locking behavior before running the migration.