mongodb索引数据结构
mongodb 是否区分由小型静态大小元素(例如数字类型)构造的索引和具有大型变体类型(例如字符串)的索引?
从 BSON 规范中我可以看到 BSON 确实表现出了对整数类型进行特殊处理的能力。如果索引仅包含 int64,我希望索引代码能够创建性能更高的索引。
也许它有某种形式的受歧视联盟?
Does mongodb discriminate between indices constructed of small, statically sized elements (lets say numeric types) and those with large variant types (such as strings) ?
From the BSON spec I can see that BSON does show the capacity of special treatment of integral types. I would expect the indexing code to create more performant indices if the index contains only int64's.
Perhaps it has some form of discriminated union ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
B 树内容基本上只是索引字段的 BSON 序列化表示和指向该对象的磁盘位置的指针。
这是代码链接其中提到了这一点。事实上,这是
他们在循环索引时使用 woCompare
函数。在我看来,这就像一个简单的二进制比较,因此较小的数据比较大的数据比较快。
The B-Tree contents are basically just the BSON serialized representation of the indexed fields and a pointer to the disk location of that object.
Here is a link to the code where it mentions this. In fact, here is the
woCompare
function they use while looping through the index.Looks to me like a simple binary comparison, so smaller data will compare faster than larger data.