The schema was breaking. The last query ran stale because the table needed one thing: a new column.
Adding a new column seems trivial until it touches production. It is not just an ALTER TABLE command. It is a contract change. Every job, every service, every pipeline reading from this table will feel it. A careless write can lock rows, block requests, and cascade into downtime.
Design starts at the DDL. Choose the right data type. Decide if the column should allow nulls or carry a default value. Understand how each database engine handles the operation—online vs blocking, index impact, lock strategies. Postgres can add a nullable column instantly. Adding a column with a default value may rewrite the table. MySQL’s behavior depends on storage engine and version.
In production, changes must be safe. Apply the principle of backward compatibility. Add the new column without constraints. Backfill data in small batches to avoid lock contention. Only after backfill and verification should you add constraints or indexes. Coordinate deployments so the column exists before application code writes or reads it.