mongodb的索引是否会占用内存?

mongodb的索引对磁盘空间的消耗比较大,它是否又会同时占用内存?当使用索引执行查询时,mongo引擎要首先在索引树中找到匹配的文档在磁盘上的位置,那么这个“索引树”是在磁盘上还是在内存里,也就是mongo的引擎是使用磁盘上的索引查,还是使用内存里的索引查?

回答:

图片描述

回答:

官方解析:
https://docs.mongodb.com/manu...

Indexes that Hold Only Recent Values in RAM¶

Indexes do not have to fit entirely into RAM in all cases. If the value of the indexed field increments with every insert, and most queries select recently added documents; then MongoDB only needs to keep the parts of the index that hold the most recent or “right-most” values in RAM. This allows for efficient index use for read and write operations and minimize the amount of RAM required to support the index.

以上是 mongodb的索引是否会占用内存? 的全部内容, 来源链接: utcz.com/p/197300.html

回到顶部