Adding a new column is simple in theory. In practice, it can block deployments, lock writes, or leave data inconsistent if done carelessly. For high-traffic systems, even a small schema change demands precision.
A new column can be added with an ALTER TABLE statement. In most relational databases, this operation is fast for metadata-only changes, like adding a nullable column without a default value. But an ALTER TABLE that rewrites the entire table—such as adding a non-nullable column with a default—can lock the table and stall production traffic.
In Postgres, ALTER TABLE my_table ADD COLUMN new_column TEXT; adds a nullable column instantly. The moment you set a default and require NOT NULL, the migration can become costly. The safest path in large systems is a multi-step migration:
- Add the column as nullable with no default.
- Backfill the data in small batches.
- Add constraints only after data completeness is verified.
For MySQL with InnoDB, adding a column can require a table rebuild unless you are on a version with instant DDL support. Even then, column ordering and type choices may still trigger a copy. Always check your database documentation for the fastest path to add a column without downtime.