Adding a new column to a database table is one of the most common schema changes, yet it’s also one of the most dangerous. In production, even a small change can lock tables, block queries, or cause downtime. The right approach depends on the database engine, data size, and concurrency.
In PostgreSQL, ALTER TABLE ADD COLUMN executes fast for empty columns with defaults set to NULL. But adding a column with a non-null default can rewrite the whole table. MySQL can have similar issues, though recent versions with ALGORITHM=INSTANT reduce the risk. For massive datasets, online schema changes are the safest path. Tools like pt-online-schema-change or native partitioning strategies can help prevent blocking writes.
When adding a new column to an application-facing data model, migrations must be backward-compatible. Deploy the schema change first, then update code to use the new column. Avoid dropping old columns or renaming them in the same deployment. Staggering changes prevents broken queries during rollout.