mongo收集中的数据碎片 [英] Data fragmentation in mongo collection
问题描述
我在一个mongo集合中进行了大量更新,并在此之后假设文件系统上存在巨大的碎片.我主要担心的是,集合将在文件系统上不断增长,而集合中的数据却没有有价值的增长.
I have a lot of updates in one mongo collection and assume huge fragmentation on file system after that. My main concern that collection will constantly grow on file system without valuable growing of data in collection.
能否请您确认或驳斥我的担忧?
Could you please confirm or refute my concern?
推荐答案
这取决于您要进行的更新类型.如果这些更新增加了您的文档(数组推送或类似的文档),那么可以,您将有一些支离破碎的信息.就地更新($ inc)不会导致文档移动(无碎片).
It depends on what kind of updates you're making. If these updates grow your document (array push or similar), then yes, you will have some fragmentation. In-place updates ($inc) don't cause document to be moved (no fragmentation).
顺便说一句,它本身不是碎片,而是一些浪费的空间.也就是说,如果将文档移到新位置,则其旧位置将不会被重复使用.
By the way, it's not fragmentation per se, but rather some wasted space. That is, if document is moved to a new location, its old location won't be reused.
这篇关于mongo收集中的数据碎片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!