-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.6.3
-
Component/s: Aggregation Framework
-
Fully Compatible
-
ALL
-
-
Quint Iteration 3
Original title: Empty match at the start of the aggregation pipeline greatly impacts performance in 2.6, does not in 2.4
Aggregation below:
2.4.9 - 15-17 seconds
2.6.3 - 71-78 seconds
Removing the empty match:
2.4.9 - 15-17 seconds
2.6.3 - 15-16 seconds
db.collection.aggregate( { "$match" : { } }, { "$project" : { "doc.field" : 1 , "doc.doc1.doc2.field" : 1 , "_id" : 1 } }, { "$unwind" : "$doc" } , { "$unwind" : "$doc.doc1"} , { "$unwind" : "$doc.doc1.doc2"} , { "$group" : { "_id" : { "doc+doc1+doc2+field" : "$doc.doc1.doc2.field" } , "count#_id" : { "$addToSet" : "$_id" } , "count#variations+variationId" : { "$sum" : 1 } } } );