-
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"}}}, {$sort: {y: 1}} ])
Our optimization pass can recognize the $match stage can be duplicated and applied to both "example" and "unionColl" collections, which means the predicate could be answered using an index.
Unfortunately we are missing an optimization to duplicate the $sort for each branch of the union and keep only a merge-sort instead of the union. We should implement this optimization.
- is duplicated by
-
SERVER-45534 Implement $sort pushdown optimization into $unionWith sub-pipeline
- Closed
- is related to
-
SERVER-55612 Improve handling of $geonear+$or when all $or clauses involve the same $near key
- Closed
- related to
-
SERVER-60800 Allow $search in $lookup/$unionWith
- Closed