mongodb索引数据结构 [英] mongodb index data structures

查看:744
本文介绍了mongodb索引数据结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mongodb是否区分由小的静态大小的元素(可以说数字类型)和大型变体类型(如字符串)构成的索引?



从BSON规范可以看出,BSON确实显示了整体类型的特殊处理能力。如果索引只包含int64,我希望索引代码创建更多的性能指标。



也许它有某种形式的歧视联盟?

解决方案

B-Tree内容基本上只是索引字段的BSON序列化表示,并指向该磁盘的磁盘位置对象。



这是一个链接到代码,它提到了这一点。其实这里是 woCompare 函数,它们在循环索引时使用。



看起来像一个简单的二进制比较,所以更小数据将比较大的数据比较快。


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 ?

解决方案

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.

这篇关于mongodb索引数据结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆