Adding a new column is one of the most common schema changes in modern software. Whether you run migrations in Postgres, MySQL, or SQLite, the goal is the same: extend your table without breaking production. Done right, it’s fast. Done wrong, it locks rows, blocks reads, and burns uptime.
In SQL, the syntax is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
The complexity begins with scale. On small datasets, this executes instantly. On large datasets, adding a new column can trigger a rewrite of the entire table. This can cause downtime or degrade query performance.
For Postgres, adding a nullable column with a default is safe if done in two steps: first add the column without the default, then set the default separately. MySQL’s ALTER TABLE can be optimized by checking the storage engine and version—InnoDB on recent versions runs many column additions in place. When possible, avoid schema changes during peak traffic windows.