[SERVER-83524] Enable indexed plans for expressions with $$NOW, $$CLUSTER_TIME, and $$USER_ROLES Created: 21/Nov/23 Updated: 19/Jan/24 |
|
| Status: | Investigating |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Steve Tarzia | Assignee: | Jacob Evans |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Assigned Teams: |
Query Optimization
|
||||||||
| Participants: | |||||||||
| Description |
|
This code from db.coll.find({"$expr": {"$lt": ["$_ts", {"$subtract": ["$$NOW",604800]}]}}) will lead to a collection scan even if there is an index on the _ts field. We should find a way to build an IXSCAN plan for such queries while still avoiding the plan cache bug fixed by Note that this was inspired by HELP-52526 for a query generated by online archive. |