-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
In classic $lookup, we query the foreign collection for each incoming localField value. This involves reconstructing and optimizing the foreign collection query for each new value. However often there are repeat localField values, which means the foreign query results will be the same if there are no let variables.
We can have a small LRU cache for the previous localField values, and only store the results if they are small (a few kb). This is beneficial when the number of distinct localField values is low, or when the localField values are arriving in sorted order (the local side query is using an index on the local field). We can skip this optimization for any tricky cases, like arrays.
- duplicates
-
SERVER-21284 $lookup should cache query results
-
- Backlog
-
- is related to
-
SERVER-21284 $lookup should cache query results
-
- Backlog
-
- related to
-
SERVER-127916 (SBE) Add a small foreign collection result cache to $lookup for repeat localField values
-
- Needs Scheduling
-