The deployment froze. Everyone stared at the log output. One line mattered: ALTER TABLE users ADD COLUMN last_login TIMESTAMP;.
A new column changes a table’s shape. Done right, it’s routine. Done wrong, it locks rows, stalls writes, and forces a rollback. In production systems, adding a column is not just a schema change—it’s a shift in the contract between your database and every service that touches it.
Before adding a new column, confirm its purpose and type. Choose column names that are unambiguous. Check the size of the table, indexes, and access patterns. Consider default values. A column with a default on a large table can rewrite every row and cause downtime. When possible, make it nullable first. Backfill data in controlled batches. Then set constraints.
Transactional databases like PostgreSQL and MySQL handle new column operations differently. In PostgreSQL, adding a nullable column is fast. In MySQL, the storage engine and version affect whether the operation is instantaneous or blocking. For distributed SQL databases, there might be schema change protocols that run in stages—plan for them.