[SERVER-47466] Optimize $push in $group to limit array size if followed by $slice of same field Created: 10/Apr/20 Updated: 06/Dec/22 |
|
| Status: | Backlog |
| Project: | Core Server |
| Component/s: | Aggregation Framework |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Asya Kamsky | Assignee: | Backlog - Query Optimization |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | optimization, qopt-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Optimization
|
| Participants: |
| Description |
|
If I have a pipeline
We can pull in knowledge that only first 5 elements are needed from "a" in $group and stop pushing more elements after we have that many. |
| Comments |
| Comment by keshav garg [ 28/Sep/21 ] |
|
Is there any workaround, to satisfy this use case? |
| Comment by Asya Kamsky [ 10/Apr/20 ] |
|
if there are no other accumulators in $group we can even shortcircuit processing the stage once we have enough to satisfy slice. |