Adding a new column should be simple. Yet, it can break a deployment, stall a release, or corrupt production data if handled carelessly. A new column changes schemas, affects indexes, and can ripple through code, queries, and APIs.
In SQL, adding a new column is done with ALTER TABLE. This is fast for small tables, but in large datasets it can lock writes and cause downtime. Some databases support ADD COLUMN as an online operation. Others require planning with migrations that run in low-traffic windows or use background copy operations. Always confirm the default value, nullability, and data type. A careless NOT NULL without a default can crash the migration.
In PostgreSQL, adding a nullable column without a default is instant. Adding a column with a default rewrites the table in older versions but is optimized in newer releases. Use CREATE INDEX CONCURRENTLY when indexes are needed for the new column to avoid table locks.
In MySQL, ALTER TABLE often copies the whole table. Check the engine—InnoDB handles some changes faster with ALGORITHM=INPLACE. Watch the lock type. Even with online DDL, long-running queries can block or be blocked.