[SERVER-21612] Combine post $lookup $match on looked up field Created: 22/Nov/15 Updated: 04/Nov/20 Resolved: 25/Apr/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.6 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Asya Kamsky | Assignee: | Benjamin Murphy |
| Resolution: | Done | Votes: | 1 |
| Labels: | bi-performance, optimization, performance | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||
| Sprint: | Query 11 (03/14/16), Query 12 (04/04/16), Query 13 (04/22/16), Query 14 (05/13/16) | ||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||
| Case: | (copied to CRM) | ||||||||||||||||||||||||||||
| Description |
|
In the scenario where the agg pipeline is:
we should be able to merge the query for f2:someValue into the query into "c2" as find:{bar:"$foo", f2:someValue} as a performance optimization. |
| Comments |
| Comment by Charlie Swanson [ 26/Oct/16 ] | |
|
I'd like to add a note to benjamin.murphy's comment above:
There are some caveats here, namely:
| |
| Comment by Benjamin Murphy [ 25/Apr/16 ] | |
|
This ticket introduces a new optimization to the aggregation pipeline, enabling $lookup to swap with, or absorb, a $match, with the following semantics: 1. A $match that is entirely independent of the $lookup can be moved before the $lookup. 2. A $match that consists entirely of predicates upon the "as" field of the $lookup can be moved inside the $lookup and executed as part of the query on the foreign collection. | |
| Comment by Githook User [ 25/Apr/16 ] | |
|
Author: {u'username': u'benjaminmurphy', u'name': u'Benjamin Murphy', u'email': u'benjamin_murphy@me.com'}Message: |