“尺寸"与“尺寸"之间的区别是什么?和"storageSize"由Mongo stats()函数显示 [英] What is difference between "size" and "storageSize" displayed by Mongo stats() function

查看:130
本文介绍了“尺寸"与“尺寸"之间的区别是什么?和"storageSize"由Mongo stats()函数显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Mongo stats()函数显示的大小"和存储大小"之间有什么区别?哪一个显示特定集合在磁盘上的实际大小?参考命令返回的示例数据

What is difference between "size" and "storageSize" displayed by Mongo stats() function? Which one shows the actual size on disk for a particular collection? Refer sample data returned by command

db.getCollection('temp_collection').stats()


{"ns" : "DB1.temp_collection",
    "count" : 1035219,
    "size" : 1186,
    "avgObjSize" : 1202,
    "storageSize" : 177,
    "capped" : false,
    "wiredTiger" : 
}

推荐答案

简而言之:

  • size用于逻辑分配(这由数据库引擎看到)
  • storageSize用于分配物理文件空间
  • size refers for logical allocation (this is seen by database engine)
  • storageSize refers for physical file space allocation

由于使用了WT(WiredTiger),并且启用了数据压缩,因此由于压缩,物理分配会变小

As WT (WiredTiger) is used, with enabled data compression, then physical allocation is smaller because of compression

db.collection.storageSize

db.collection.stats

这篇关于“尺寸"与“尺寸"之间的区别是什么?和"storageSize"由Mongo stats()函数显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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