Adding a new column isn’t just schema work. It’s a tactical move in the life of your database. Done wrong, it locks rows, burns CPU, and sends query times into the dirt. Done right, it opens the door to new features, sharper analytics, and faster product iteration.
Start with definition. In SQL, a new column can be added with ALTER TABLE. For example:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
That looks simple. It isn’t. On large datasets, adding a new column can be an expensive operation. In Postgres, it can require a table rewrite if you set a default, depending on the type and version. In MySQL, it may lock the table for the entire duration. Plan for concurrency. Schedule off-hours if blocking writes is unacceptable.
Consider nullability. Making a new column NOT NULL with a default may cause an immediate backfill, which can freeze production under load. When possible, add it nullable first, backfill incrementally, and then enforce constraints in a second migration.