为什么 MongoDB 数据库使用空间架构不同? [英] Why dis-similarities in MongoDB Database Used Space Architecture?

查看:33
本文介绍了为什么 MongoDB 数据库使用空间架构不同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们几天前开始使用 MongoDB,但我们不明白为什么 MongoDB 使用的总磁盘空间和 MongoDB 使用的数据库大小有如此大的差异.我的担忧如下:

We have started using MongoDB few days ago but We couldn't understand why there is so Dis-Similarities with Total Disk Space Used by MongoDB and Data-base size Used by MongoDB. My Concern is as follows:

当我们执行查询时 db.stats();我们看到的细节如下:

When we execute the query db.stats(); we saw the details as follows:

  • 数据大小:232.68MB
  • 存储大小:292.58MB
  • 索引大小:204.51MB
  • 平均对象大小:171MB

如果我们检查数据库位置,总文件大小(test.0+test.1+test.2..etc)是2.8GB".在添加[datasize+storagesize+indexsize+avgobjsize = 900.77MB]的情况下,为什么它不等于磁盘2.8GB"使用的物理空间.除了 datasize、storagesize、indexsize、avgobjsize 之外,还有什么空间分配给 MongoDB.能否请您向我们提供您的准确建议.

If we check in the database location, total file size (test.0+test.1+test.2..etc) is "2.8GB". In the event of adding the [datasize+storagesize+indexsize+avgobjsize = 900.77MB] why it's not equal to the physical space used by the Disk "2.8GB". Apart from datasize, storagesize, indexsize, avgobjsize what else space is allocated for MongoDB. Can u please provide us your precise suggestion.

先谢谢了,

推荐答案

数据大小是实际文档使用的空间量.

Data Size is the amount of space the actual document uses.

存储大小是内部为文档分配的空间量.MongoDB 会自动向实际文档大小添加填充,以使更新无需移动磁盘.因此存储大小通常大于数据大小.将其视为位于实际文件系统之上的虚拟文件系统.

Storage size is the amount of space allocated internally for the documents. MongoDB automatically adds padding to the actual document size to make updates not require a move on disk. Therefore storage size is typically larger than data size. Think of this as a virtual filesystem on top of the actual file system.

FileSize 是主机操作系统文件系统中磁盘上分配的空间量.这是以 2GB 为增量完成的,并且通常大于存储大小.

FileSize is the amount of space allocated on disk in the host OS's filesystem. This is done in 2GB increments and typically is larger than the storage size.

对集合运行压缩或修复可以通过移除填充来缩小存储大小.这在文档在磁盘上增长的情况下通常很有用然后删除了一些数据.它仍然占用存储大小的最大大小,所以如果你有很多增长&然后缩小,这有助于收回空间.

Running compact or repair on a collection can shrink the storage size by removing the padding. This is most often useful in the case where a document grew on disk & then some data was removed. It still takes up the maximum size in storage size, so if you have a lot of churn on growing & then shrinking, this can help recoup space.

FileSize 永远不会缩小,除非您将其移动到另一个系统,因为该空间已在磁盘上分配给 MongoDB 使用.但是,缩小存储大小可以减少对另一个 FileSize 分配的需求,从而有效地重用先前分配的空间.

FileSize never will shrink unless you move it to another system, since the space has been allocated on disk for use by MongoDB. However, shrinking storage size can reduce the need for another FileSize alloc, thus effectively re-using space previously allocated.

这篇关于为什么 MongoDB 数据库使用空间架构不同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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