The table was ready, but something was missing. You needed a new column. Without it, your data model was incomplete, your queries slower, your code less clear.
Adding a new column is not just schema change—it’s control over your data structure. In SQL, the ALTER TABLE statement is the direct path. Run it once in development. Run it again in staging. Watch for locks in production.
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
This executes instantly on small datasets. On large tables, plan for migration strategy. Break downtime risk with background updates, column defaults, and backfilling in batches. Use NULL defaults first when you want zero rewrite cost, then UPDATE incrementally.
In PostgreSQL, adding a column with a default value can lock writes. For MySQL, the behavior depends on the storage engine. In distributed databases like CockroachDB, schema changes can stream in without blocking, but monitor replication carefully.