The SQL prompt fired. A schema waited, but the data model needed change. You typed one command: ADD COLUMN.
Adding a new column is more than an afterthought. It reshapes queries, indexes, and performance. In relational databases like PostgreSQL, MySQL, and SQL Server, a new column means altering the table structure at its core. The operation can be simple for small datasets, but at scale it can lock writes, spike CPU, and block dependent queries. Choosing the right strategy means the difference between a smooth deploy and a stalled migration.
The syntax depends on the database:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This command is straightforward, but not always safe in production. The risk increases when the table is large or the column has constraints or default values. In PostgreSQL, adding a column without a default is near-instant. With a default, the system rewrites the table, which can take hours. MySQL behaves differently—operations on InnoDB tables may require copying data internally, even for simple alters.