gpt4 book ai didi

mongodb - MongoDB : differences between "nscanned" and "nscannedObjects" 中的解释()

转载 作者:IT老高 更新时间:2023-10-28 13:04:45 24 4
gpt4 key购买 nike

我无法在 Mongodb 的解释查询输出中得到“nscanned”和“nscannedObjects”之间的确切区别。

开启 MongoDB Explain documentation我可以阅读:

nscanned Number of items (documents or index entries) examined. Items might be objects or index keys. If a "covered index" is involved, nscanned may be higher than nscannedObjects.

nscannedObjects Number of documents scanned.

这两个字段有什么不同?更具体地说,当我有一个使用 BtreeCursor(索引)的查询时,这意味着什么,这两个字段有两个不同的值,例如:

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

我知道“covered index" 是什么。我想确切地了解查询在上面的示例中做了什么。它是否通过 ("scanned") 9 个元素 (nscanned = 9),其中所有元素都是索引条目并读取("examined")其中只有 5 个元素 (nscannedObjects = 5) 的值以生成结果集?

最佳答案

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

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

关于mongodb - MongoDB : differences between "nscanned" and "nscannedObjects" 中的解释(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13910097/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com