The fix wasn't another query tweak — it was adding a new column.
A new column changes the shape of your data. In SQL, this means ALTER TABLE with precision. In NoSQL, it means updating schema definitions or ensuring your documents can handle the extra key without breaking existing logic. Either way, the goal is zero downtime and no silent failures.
When you add a new column, you decide on type, nullability, default values, and indexing. Each decision affects performance, storage, and query plans. Adding a nullable column costs less at write-time but might complicate reads. Adding a default value can simplify downstream services but could inflate migration time on large datasets.
In production systems, a new column migration should be tested on staging with realistic scale. Measure how the schema change impacts query performance. Benchmark both cold and warm caches. Check for ORM-level issues where the new property may not map cleanly without model updates.