The query returned fast, but the shape of the data was wrong. You needed one more field. You needed a new column.
Adding a new column is simple in concept but often critical in practice. It changes the schema. It changes how queries run. It can change the way your system stores and retrieves data. The best approach depends on your database engine, your runtime, and your migration strategy.
In SQL, the basic syntax is direct:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This command modifies the table definition and appends the new column. On large tables, this can lock writes and slow reads. For production workloads, schedule the change during low-traffic windows or use online schema change tools. PostgreSQL, MySQL, and MariaDB each have different levels of support for concurrent column additions.
When adding a new column with a default value, understand how defaults propagate at the storage layer. Some databases backfill immediately; others apply the default only to future inserts. This choice affects CPU, I/O, and replication lag. If replication is in play, test the change on a staging replica first.