-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.0-rc1
-
Component/s: Aggregation Framework
-
Query Optimization
If you are doing an aggregation on a large collection, and your aggregation contains a $lookup stage which queries a smaller collection (think <= 100 documents), the $lookup stage will issue a query for each document in the larger collection.
The $lookup stage should cache the results of the query to avoid unnecessary work in situations like this.
Original Description
I have tried the $lookup aggregator and the performance was not as expected.
I have one collection with about 350K documents and one with 100 documents.
There are two indexes on the “localfield” and on the “foreignfield”.
I am trying to join the first collection with the second.
After an exchange of emails with Norberto : "it looks like it is not using either indexes, and therefore it's taking so long. "
Please find above the link to test:
https://github.com/bappr/lookup-test
- is duplicated by
-
SERVER-64021 Lookup stage poor performance
- Closed
- is related to
-
SERVER-21312 $lookup should batch query requests
- Backlog
-
SERVER-49461 Slow performance when doing lookup in small sets
- Closed