The query was slow, and the logs showed why: the schema had changed, but the index had not. You needed a new column.
Adding a new column sounds simple. In practice, it can break deployments, block writes, and cause downtime. The safest path is to understand the tradeoffs of each approach before typing ALTER TABLE.
In relational databases, a new column changes the shape of the data. On small tables, the update runs fast. On large ones, it can lock rows for minutes or hours. Some engines rewrite the whole table. Others store null markers until data is written. The method you choose depends on schema migration tooling, transaction limits, and your tolerance for lock contention.
For MySQL, ALTER TABLE ADD COLUMN is a blocking operation unless you use ALGORITHM=INPLACE or an online schema change tool like pt-online-schema-change. PostgreSQL can add a new column with a default of NULL instantly, but adding it with a non-null default rewrites the table. SQLite always rewrites the file. Modern cloud providers often offer online DDL, but you must confirm the exact behavior for your version and storage tier.