问题一:mongo索引的数据结构为B-树,但是B-树各个节点节点之间是无指针相连的,那么当进行范围查询或遍历时,是如何在B-树上完成的?
问题二:B-树的数据遍布在每个节点上,那么mongo非_id索引节点上的数据是存的_id吗?通过非_id索引查询数据时,也是先找到对应的_id列表,然后再去_id索引中查找完整的数据吗?
问题三:mongo作为文档型数据库,我们在使用mongo作为数据库时,会推荐把相关的实体以嵌套文档的形式作为一条数据存储,而不是像关系型数据库中那样分多张表存储,那么单条数据过大会影响整张表的性能吗?如果会,那单条数据的大小一般建议是多大呢?
查找资料很久没查到,希望大佬解决小弟心中疑惑,感激不尽
感觉有的答案与我查找与理解不符合
mongo索引的数据结构绝对为B-树,但有不同,就是非叶子没有数据,只有叶子有数据地址。数据之间,也就是同一个extent内的数据之间有双向链表连接,但这个顺序与B+树要求的叶子数据链接没有毛线关系,何况不同的extent之间的数据是不链接的,只是extent之间链接。B树不可能从叶子数据地址进行范围检索的,但B树是排序树,肯定可以范围查找。
根据目前MongoDB主开发人员的意思,他们不打算放开单条16M这个限制,但会随着计算资源相对成本的降低(内存更便宜,网络更快)而适度调高。
官方解释:
MongoDB limits the data size of individual BSON objects/documents. At the time of this writing the limit is 16MB.
This limit is designed as a sanity-check; it is not a technical limit on document sizes. The thinking is that if documents are larger than this size, it is likely the schema is not ideal. Further it allows drivers to make some assumptions on the max size of documents.
The concept is that the maximum document size is a limit that ensures each document does not require an excessive amount of RAM from the machine, or require too much network bandwidth to fetch. For example, fetching a full 100MB document would take over 1 second to fetch over a gigabit ethernet connection. In this situation one would be limited to 1 request per second.
Over time, as computers grow in capacity, the limit will be adjusted upward.