Adding a new column is one of the most common database changes, but it comes with risk. Performance can shift. Queries can break. Deploy windows shrink under pressure. The way you define and deploy that change determines whether you ship clean or cause a fire.
In SQL, a new column can be added with ALTER TABLE, often using:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL;
On small datasets, the command runs in seconds. On large production tables, it can lock writes, stall reads, or trigger downtime. To make this safe, you need to understand the database engine’s behavior. PostgreSQL may rewrite the table if you set a default that’s not NULL. MySQL requires care with column position and storage. Avoid heavy defaults in the initial migration. Instead, add the column as nullable, backfill in controlled batches, then enforce NOT NULL if needed.
Indexing a new column should be timed. An index creation can double the cost if run in the same migration. Use concurrent indexing in PostgreSQL or an online DDL in MySQL to avoid write locks.