了解Mongo DB的说明 [英] Understanding mongo db explain

查看:87
本文介绍了了解Mongo DB的说明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我触发了一个查询,并试图在mongo控制台上对其进行解释并得到

I fired a query and tried to explain it on mongo console and got

"isMultiKey" : true,
"n" : 8,
"nscannedObjects" : 17272,
"nscanned" : 17272,
"nscannedObjectsAllPlans" : 21836,
"nscannedAllPlans" : 21836,
"scanAndOrder" : true,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 184,

大多数内容在 http://www.mongodb.org/display/DOCS中进行了解释/说明,但是我不明白nscannedAllPlans是什么意思,nscannedAllPlans是什么意思.有人可以帮忙吗?

Most of the things are explained in http://www.mongodb.org/display/DOCS/Explain, but I cannot understand what does nscannedObjectsAllPlans, nscannedAllPlans means. Can anyone help?

谢谢

推荐答案

nscannednscannedObjects报告获胜计划的结果.

nscanned and nscannedObjects report results for the winning plan.

nscannedAllPlansnscannedObjectsAllPlans报告所有计划的结果

nscannedAllPlans and nscannedObjectsAllPlans report results for all plans

例如:

>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 );
{
  "cursor": "BtreeCursor a_1_b_1",
  "isMultiKey": false,
  "n": 2,
  "nscannedObjects": 2,
  "nscanned": 2,
  "nscannedObjectsAllPlans": 6,
  "nscannedAllPlans": 6,
  "scanAndOrder": false,
  "indexOnly": false,
  "nYields": 0,
  "nChunkSkips": 0,
  "millis": 2,
...
}

这篇关于了解Mongo DB的说明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆