[SERVER-42579] combined $match and $project stages Created: 01/Aug/19 Updated: 04/Sep/19 Resolved: 04/Sep/19 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Mitereiter Balazs Zoltan | Assignee: | Danny Hatcher (Inactive) |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | $match, $project, fetch, optimization | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Mongo DB version 4.0.10 |
||
| Participants: |
| Description |
|
We ran into an aggregation pipeline optimization problem. We have a $match stage and a $group stage. The $match stage uses an index and its optimal, it returns approx. 32k (avg. size 1.7KB) documents. The fetch takes long 400-500 ms from total runtime of 500-600ms , wouldn't it be possible to merge a $match and $project stage so we could filter unnecessary fields for the $group stage. We experimented with the regular find method and we saw a significant benefit for the fetch with projecting. |
| Comments |
| Comment by Danny Hatcher (Inactive) [ 05/Aug/19 ] |
|
For us to best look into this, can you please provide examples of your slow aggregations and fast finds with their relevant explains? |