Adding a new column is never just about storage. It changes queries, indexes, migrations, and often the shape of your API. Choosing the wrong path here can slow the system, cause downtime, or block deploys. Done right, you expand capability without risking production.
In SQL, the core options are straightforward:
ALTER TABLE ADD COLUMN — The direct way. Works well on small tables, but can lock rows or block writes on larger datasets.
CREATE TABLE and migrate — Build a new schema, backfill, and switch. More steps, but zero-downtime with the right migration tooling.
Nullable vs. NOT NULL — Adding a NOT NULL column with a default on a large table can be expensive. Use nullable first, fill values, then apply the constraint.
For PostgreSQL, adding a column without a default is fast because it only changes metadata. Avoid large default values in a single step. For MySQL, watch out for table rebuilds; use ONLINE DDL if the engine supports it. With NoSQL databases like MongoDB, adding a new field requires no migration, but indexing the field later can be costly.