[SERVER-20506] Conditionally order $match with $unwind Created: 18/Sep/15 Updated: 05/Dec/16 Resolved: 30/Mar/16 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework, Performance |
| Affects Version/s: | None |
| Fix Version/s: | 3.3.4 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Jeffrey Yemin | Assignee: | Benjamin Murphy |
| Resolution: | Done | Votes: | 0 |
| Labels: | bi-performance, optimization | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||||||||||||||||||
| Sprint: | Query 10 (02/22/16), Query 11 (03/14/16), Query 12 (04/04/16) | ||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
The subset of a $match following an $unwind that does not filter on the unwound field can be moved up in the pipeline. For example:
is equivalent to:
|
| Comments |
| Comment by Benjamin Murphy [ 30/Mar/16 ] |
|
This ticket introduces a new aggregation optimization, allowing a $match stage following a $unwind to split into two pieces: One that is dependent upon the path being unwound, and one that is not. The independent $match is put before the $unwind in the pipeline, and the dependent after. |
| Comment by Githook User [ 30/Mar/16 ] |
|
Author: {u'username': u'benjaminmurphy', u'name': u'Benjamin Murphy', u'email': u'benjamin_murphy@me.com'}Message: |
| Comment by Asya Kamsky [ 20/Jan/16 ] |
|
Part of |