The query finished running, but the feature you need isn’t there yet. You have to add a new column.
A new column changes the shape of your data. It can unlock faster queries, cleaner joins, and simpler logic. But adding it the wrong way can cause downtime, broken indexes, or silent data corruption.
In relational databases like PostgreSQL or MySQL, adding a new column is straightforward at the schema level:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
Under the hood, this command may lock the table, rewrite it, or trigger background processes. On large datasets, that can block writes or spike CPU. For zero-downtime changes, use algorithms that avoid full rewrites. PostgreSQL 11+ supports adding nullable columns instantly. MySQL’s ALGORITHM=INPLACE can speed this up, depending on engine and column type.
When defining a new column, plan defaults carefully. A default with a function like NOW() will evaluate at insert time, not at creation. Backfilling historical data should be done in controlled batches to avoid load spikes.