The database screamed for change. You built the schema months ago, confident it would hold. Now requirements shift, and the table must evolve. A new column is the cleanest way forward.
Adding a new column should be fast, safe, and predictable. The operation must preserve existing data, handle defaults, and integrate with existing queries without breaking production flows. In most relational databases, the ALTER TABLE statement is the foundation:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP DEFAULT NOW();
This syntax is simple, but production environments demand more than syntax. You need to think about migration strategies, locking behavior, and index creation.
When a new column is added, the database often rewrites data pages or updates metadata. In large tables, this can cause noticeable locks. Some systems—like PostgreSQL—can add columns with default values without a full table rewrite, reducing downtime. MySQL may require careful planning to avoid locking in busy workloads.