The query was slow, and the logs told you why. A missing index, a bad join, but the real pain came from the schema. You needed a new column.
Adding a new column should be simple. In SQL, the command is clear:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
But the real work is more than syntax. A new column changes the shape of your data. Done wrong, it can lock a table, block writes, and even take down production. On large datasets, a naive migration can stall for hours.
Plan the change. Decide if the new column needs a default value. Some databases rewrite the whole table when a default is set, which can be costly. Test in staging with realistic data volumes. For MySQL and PostgreSQL, check if the operation is truly ONLINE. For distributed databases, understand how replicas handle schema changes.