Adding a new column to a database table should be quick and safe, yet it’s where many deployments slow down or break. Migrations run long. Locks stall writes. Data consistency is at risk. Getting it right means understanding how the database engine handles schema changes.
In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward for nullable or default-null columns. The command updates the table metadata without rewriting existing rows. For large datasets, this is critical to avoid downtime. But if you set a NOT NULL with a non-default value, expect a full table rewrite. That can block transactions and delay release windows.
In MySQL, ALTER TABLE behavior depends on the storage engine. InnoDB now supports instant ADD COLUMN in many cases, which means no table copy. But certain column types or position changes force a rebuild. Understanding ALGORITHM=INSTANT, ALGORITHM=INPLACE, and LOCK=NONE options can save hours.