2

我已经阅读了这个“错误”报告 - https://jira.mongodb.org/browse/SERVER-4095

但是,它并不能完全解释为什么“distinct”不只扫描 B 树索引的顶部,它只有 4 个条目。这就是我所做的:

run Distinct

Result
"n" : 535216,
            "nscanned" : 535216,
            "nscannedObjects" : 0,
            "timems" : 1871,
            "cursor" : "BtreeCursor path_1"

db.logs.dropIndex("path_1")

run Distinct

Result
            "n" : 535216,
            "nscanned" : 535216,
            "nscannedObjects" : 535216,
            "timems" : 1426,
            "cursor" : "BasicCursor"

有人可以尝试准确解释为什么会发生这种情况吗? 内存开销的解释并没有让我真的很开心。如果你有一个顶层有 4 个元素的 B-Tree 索引,那为什么会有问题呢?非常感谢建设性的反馈!

4

0 回答 0