The table is live. The schema is set. But the product owner wants one more field. You need a new column, and you need it now.
Adding a new column can be straightforward or a minefield, depending on how you handle it. In a relational database, a column defines the structure for storing data in each row. Adding it changes your schema, and with that comes risk: performance hits, lock contention, and downstream integration issues.
In SQL, the common pattern is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP NULL;
On small tables, this runs fast. On large ones, it can block reads and writes. Modern engines like PostgreSQL can add certain types of columns instantly, but not all. MySQL may rebuild the table. Always check your database’s documentation for column-adding specifics.
You also need to decide on defaults. Adding a NOT NULL column with no default value will force a full table update, which can be costly. Use NULL if possible, then backfill values in batches. If you must use a default, understand how your database applies it.