Some queries that were once fast are now approaching timeout limits. Indexes exist, but performance gains are inconsistent. As more filters and joins are added, tuning becomes difficult. I want to understand why SOQL optimization gets harder at scale?
SOQL performance depends heavily on data distribution, not just indexing. As datasets grow, even indexed fields may become less selective, especially when values are skewed. Queries that rely on optional filters or OR conditions are particularly vulnerable.
Another factor is query evolution. Over time, new conditions are added to satisfy business logic, often without reevaluating selectivity or execution plans. This gradually degrades performance.
Long-term optimization often requires revisiting data models, using skinny tables where appropriate, or redesigning how data is queried rather than tweaking individual queries.
Takeaway: SOQL optimization is an ongoing process that must evolve with data growth.