Adding a new column is one of the most common changes in database schema evolution. Done right, it secures data integrity and keeps performance predictable. Done wrong, it can lock your table, break downstream queries, and slow deploys.
Start by defining the purpose of the column. Decide on the correct data type. For large datasets, adding a nullable column avoids a full table rewrite. Use DEFAULT values carefully—on high-traffic systems they may trigger a costly update across all rows.
Plan migrations in small, reversible steps. In SQL, the syntax is straightforward:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL;
But in production, timing matters. Run schema changes during low traffic or in controlled deploy phases. Monitor locks and query performance during the migration.