nscanned
和nscannedObjects
报告的是获胜的查询计划的结果。
nscannedAllPlans
和nscannedObjectsAllPlans
报告的是所有计划的结果。
文档
索引条目扫描次数。 totalKeysExamined
对应于MongoDB早期版本中cursor.explain()
返回的nscanned
字段。
例如:
t = db.jstests_explainb;
t.drop();
t.ensureIndex( { a:1, b:1 } );
t.ensureIndex( { b:1, a:1 } );
t.save( { a:0, b:1 } );
t.save( { a:1, b:0 } );
t.find( { a:{ $gte:0 }, b:{ $gte:0 } } ).explain( true );
{
"isMultiKey": false,
"n": 2,
"nscannedObjects": 2,
"nscanned": 2,
"nscannedObjectsAllPlans": 6,
"nscannedAllPlans": 6,
"scanAndOrder": false,
"indexOnly": false,
"nYields": 0,
"nChunkSkips": 0,
"millis": 2,
...
}
t.find( { a:{ $gte:0 }, b:{ $gte:0 } } ).explain( true );
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "test.jstests_explainb",
...
"queryHash" : "CB67518C",
"planCacheKey" : "5E76CDD1",
"winningPlan" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"a" : 1,
"b" : 1
},
"indexName" : "a_1_b_1",
}
},
"rejectedPlans" : [
{
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"b" : 1,
"a" : 1
},
"indexName" : "b_1_a_1",
}
}
],
...
},
"executionStats" : {
"executionSuccess" : true,
"nReturned" : 2,
"executionTimeMillis" : 0,
"totalKeysExamined" : 2,
"totalDocsExamined" : 2,
"executionStages" : { ... }
"allPlansExecution" : [
{...},
{...}
]
}