[SERVER-79765] $match gets absorbed into ixscan when preceded by $group on $meta with accumulator on $meta Created: 04/Aug/23 Updated: 27/Oct/23 Resolved: 18/Aug/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Alice Li (Inactive) | Assignee: | Gil Alon |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Query Integration
|
||
| Operating System: | ALL | ||
| Steps To Reproduce: | 1. Run a timeseries aggregation with the pipeline
2. Print out the result of the optimized pipeline
|
||
| Sprint: | QI 2023-09-04 | ||
| Participants: |
| Description |
|
In a timeseries pipeline, when we first have a $group stage on the $meta field and an accumulator on the $min as the first stage, and then have a $match on the _id as the second stage, the pipeline is rewritten to absorb the $match into the index scan and leave the $group stage. In essence, the stages $_unpack -> $group(_id=$meta, min=$meta) -> $match (_id=1) gets reordered to $IXSCAN (with $meta=1) -> $group(_id=$meta, min=$meta)
|