Adding a new column is one of the most common schema changes in databases, yet it can also be one of the most disruptive. Done wrong, it locks your queries, spikes load, and blocks deploys. Done right, it’s invisible.
A new column can store fresh data, enable new features, or replace a messy workaround. The challenge is adding it without breaking production. For relational databases like PostgreSQL and MySQL, adding a column can be online or offline depending on the engine and the column definition. Nullability, default values, and backfilling strategy all matter.
If you add a NOT NULL column with a default, some engines rewrite the entire table. This can take minutes—or hours—on large datasets, blocking reads and writes. The more efficient pattern is to add the column as nullable first, then backfill data in small, controlled batches, then add the NOT NULL constraint when the table is ready. This avoids long locks and load spikes.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast if the column is nullable without a default. In MySQL, the behavior depends on storage engine and version. Always check documentation and test in a staging environment that mirrors production.