Adding a new column is one of the most common schema changes in modern applications. It sounds simple, but at scale, even a single ALTER TABLE can lock writes, spike CPU, and bring down critical services. How you add a new column depends on the database engine, table size, and traffic patterns.
In PostgreSQL, adding a new column without a default is fast and lock-free for most workloads. With a non-null default, Postgres rewrites the entire table — crippling performance on large datasets. Engineers often work around this by adding the column with NULL allowed, then backfilling in small batches, and finally setting the default.
MySQL behaves differently. Newer versions with INSTANT DDL allow instant column adds, but only under certain constraints. For larger legacy deployments, tools like gh-ost or pt-online-schema-change make non-blocking changes possible, but they require testing and careful rollout.