-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.4.0
-
Component/s: Aggregation Framework, Performance
-
Query Optimization
Consider the following pipeline:
db.example.aggregate([ {$unionWith: "unionColl"}, {$match: {example: {$eq: "predicate"}}}, {$group: {_id: "$groupKey", total: {$sum: "$price"}}} ])
Unfortunately we are missing an optimization to duplicate the $group for each branch of the union and keep only a merge of pre-grouped data after the $unionWith. We should implement this optimization.
This could help in cases where part of either pipeline is happening on another shard in the cluster, or when an index could be used to speed up the group like in SERVER-9507.
- is duplicated by
-
SERVER-45532 Implement $group pushdown optimization into $unionWith sub-pipeline
- Closed