mongodb索引数据结构

发布于 2024-12-29 04:21:09 字数 169 浏览 1 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧时浪漫 2025-01-05 04:21:09

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文