The table was ready, but the New Column had nowhere to live. You could feel the gap in the schema like a loose thread in production code. Adding it should be simple. In practice, the wrong choice here can cost performance, lock queries, or break deployments.
A New Column changes the shape of your data. It can disrupt indexing, alter query plans, and shift application logic. Before you write the command, decide on the type. Use the smallest possible type that fits the data. Wide columns cost memory and I/O. If the column must allow NULLs, confirm how your tools and ORM handle them.
In SQL, the most direct way is:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
On large datasets, this can still lock the table. Minimize downtime by using database-specific features like PostgreSQL’s ADD COLUMN ... DEFAULT ... with NOT NULL in separate steps, or MySQL’s instant DDL when available. Avoid adding indexes until after the column exists, so you can control locking phases.