本文介绍了Mongodb中的explain():"nscanned"和"nscanned"之间的区别和"nscannedObjects"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在Mongodb的说明查询输出中获得"nscanned"和"nscannedObjects"之间的确切区别.

I cannot get the exact difference between "nscanned" and "nscannedObjects" in the Mongodb's explain query output.

关于 MongoDB解释文档我可以阅读:

nscannedObjects 扫描的文档数.

这两个字段之间有什么区别?更具体地讲,当我使用BtreeCursor(索引)进行查询时,这究竟意味着什么,而这两个字段具有两个不同的值,例如:

What's the different between these two fields?And more specific what does exactly mean when I have a query, which uses a BtreeCursor (an index), and these two fields have two different values, for example:

{
    "cursor" : "BtreeCursor a_1_b_1",
    "isMultiKey" : false,
    "n" : 5,
    "nscannedObjects" : 5,
    "nscanned" : 9,
    (...)
}

我知道什么是"已覆盖索引" .我想确切地了解查询在上面的示例中做了什么.它是否通过了9个元素(nscanned = 9)(其中"nscanned = 9"),它们全部都是索引条目,并且仅读取(检查")其中5个元素(nscannedObjects = 5)的值以生成结果集? /p>

I know what a "covered index" is.I would like to understand exactly what the query did in the example above.Did it pass through ("scanned") 9 elements (nscanned = 9), where all of them are index entries and read ("examined") the value of only 5 of them (nscannedObjects = 5) to produce the result set?

推荐答案

这意味着:
查询返回5个文档-n
从索引中扫描了9个文档-nscanned
然后从集合中读取5个完整文档-nscannedObjects

This means that :
The query returned 5 documents - n
scanned 9 documents from the index - nscanned
and then read 5 full documents from the collection - nscannedObjects

类似的示例在:
http://docs.mongodb.org/manual/reference/method/cursor.explain /#cursor.explain

Similar example is given at :
http://docs.mongodb.org/manual/reference/method/cursor.explain/#cursor.explain

这篇关于Mongodb中的explain():"nscanned"和"nscanned"之间的区别和"nscannedObjects"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 20:12