Adding a new column sounds simple, but it can break production if done carelessly. The schema is a contract. Every change must keep queries fast, migrations safe, and data consistent. The right approach depends on your database, workload, and deployment strategy.
In relational databases like PostgreSQL or MySQL, ALTER TABLE ADD COLUMN is the baseline command. It’s fast when adding a nullable column without a default. But adding a column with a non-null default may rewrite the whole table, locking writes and reads for the duration. On large datasets, that can mean serious downtime.
Safer patterns exist. Add the column as nullable first. Backfill in controlled batches to avoid overwhelming I/O. Once the column is populated, add constraints or defaults in a separate step. Each migration stays short and predictable.
In systems with high traffic, consider online schema change tools such as gh-ost or pt-online-schema-change. These create a copy of the table with the new column, stream changes, and swap tables at the end. This reduces blocking, though it increases temporary storage needs.