In SQL, adding a new column changes the shape of your data. It affects queries, indexes, and application logic. Done well, it brings clarity and speed. Done poorly, it creates drift and technical debt.
To add a new column in PostgreSQL:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP WITH TIME ZONE;
This runs fast for empty tables but can lock large ones. Use ADD COLUMN with a default carefully; on massive datasets, this can rewrite the table and block writes. Instead, add the column as nullable, then backfill in small batches.
In MySQL:
ALTER TABLE users
ADD COLUMN last_login DATETIME NULL;
Avoid blocking DDL on production by running migrations during low traffic or using tools like pt-online-schema-change. Know your engine’s locking behavior before you deploy.