mongo收集中的数据碎片 [英] Data fragmentation in mongo collection

查看:121
本文介绍了mongo收集中的数据碎片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个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屋!

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