The query hit the database, but the schema had changed. You needed a new column, and you needed it now.
Adding a new column should be fast, safe, and predictable. This is true whether you are updating a production PostgreSQL table with millions of rows or adjusting a MySQL schema for a single service. The wrong approach can lock tables, break queries, or cause downtime. The right approach keeps your application online while the schema changes in place.
In SQL, the ALTER TABLE command is the core tool. For example:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This works well for small tables and non-critical paths. But with large datasets, you must consider migration strategies. Write operations during an ALTER TABLE can cause blocking. Online schema change tools, such as pt-online-schema-change or database-native features like PostgreSQL’s ADD COLUMN ... DEFAULT with a constant/null default, can avoid full table rewrites.