Adding a new column sounds simple. In practice, it can break queries, force expensive table rewrites, and cause downtime if handled poorly. The right approach depends on the database engine, data size, and workload constraints.
In SQL, ALTER TABLE is the basic tool for creating a new column. In PostgreSQL, adding a nullable column with no default is fast. Adding a column with a default value on large tables may lock writes during a full table rewrite. MySQL’s behavior depends on the storage engine, with ALGORITHM=INPLACE avoiding some costs. For distributed databases, adding a new column may require schema propagation across all nodes before it becomes visible to queries.
Schema migrations that introduce a new column should be tested in a staging environment. Use migration frameworks that support transactional schema changes when available. For large datasets, consider backfilling in batches after adding the column as nullable, then applying constraints or defaults once the data is complete.