-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.4.0-rc13
-
Component/s: Aggregation Framework
-
Minor Change
-
ALL
-
v4.4
-
Query 2020-08-10, Query 2020-08-24
db.testcoll1.createIndex({testField1:1}) db.testcoll2.explain().aggregate( [ { $unionWith : { coll: "testcoll1", pipeline : [ { $match : { testField1 : { $gt : 2 } } } ] } } ] ) // shows correct plan db.testcoll2.explain("executionStats").aggregate( [ { $unionWith : { coll: "testcoll1", pipeline : [ { $match : { testField1 : { $gt : 2 } } } ] } } ] ) // shows incorrect plan! { "stages" : [ { "$cursor" : { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "test.testcoll2", "indexFilterSet" : false, "parsedQuery" : { }, "winningPlan" : { "stage" : "EOF" }, "rejectedPlans" : [ ] }, "executionStats" : { "executionSuccess" : true, "nReturned" : 0, "executionTimeMillis" : 0, "totalKeysExamined" : 0, "totalDocsExamined" : 0, "executionStages" : { "stage" : "EOF", "nReturned" : 0, "executionTimeMillisEstimate" : 0, "works" : 1, "advanced" : 0, "needTime" : 0, "needYield" : 0, "saveState" : 1, "restoreState" : 1, "isEOF" : 1 }, "allPlansExecution" : [ ] } }, "nReturned" : NumberLong(0), "executionTimeMillisEstimate" : NumberLong(0) }, { "$unionWith" : { "coll" : "testcoll1", "pipeline" : [ { "$cursor" : { "queryPlanner" : { "plannerVersion" : 1, "namespace" : "test.testcoll1", "indexFilterSet" : false, "parsedQuery" : { }, "queryHash" : "8B3D4AB8", "planCacheKey" : "8B3D4AB8", "winningPlan" : { "stage" : "COLLSCAN", "direction" : "forward" }, "rejectedPlans" : [ ] }, "executionStats" : { "executionSuccess" : true, "nReturned" : 0, "executionTimeMillis" : 0, "totalKeysExamined" : 0, "totalDocsExamined" : 0, "executionStages" : { "stage" : "COLLSCAN", "nReturned" : 0, "executionTimeMillisEstimate" : 0, "works" : 0, "advanced" : 0, "needTime" : 0, "needYield" : 0, "saveState" : 1, "restoreState" : 0, "isEOF" : 0, "direction" : "forward", "docsExamined" : 0 }, "allPlansExecution" : [ ] } }, "nReturned" : NumberLong(0), "executionTimeMillisEstimate" : NumberLong(0) } ] }, "nReturned" : NumberLong(0), "executionTimeMillisEstimate" : NumberLong(1) } ], "serverInfo" : { "host" : "asyas-mbp-4.lan", "port" : 27017, "version" : "4.4.0-rc7", "gitVersion" : "b79b53f55a5c148fd297b81a45c08d08e2cf8f94" }, "ok" : 1 }
Note that index stats on testcoll1 show the index access get incremented so I believe that the error is somewhere in massaging output for executionStats for $unionWith stage. Note that the filter is missing (no parsedQuery).
- related to
-
SERVER-50246 $unionWith explain loses information from any stages in sub-pipeline which get absorbed into cursor stage
- Closed
-
SERVER-45535 Support explain for $unionWith aggregation stage
- Closed