What is difference between “size” and “storageSize” displayed by Mongo stats() function

妖精的绣舞 提交于 2020-05-12 14:40:55

问题


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" : 
}

回答1:


in simple words:

  • size refers for logical allocation (this is seen by database engine)
  • storageSize refers for physical file space allocation

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

db.collection.storageSize

db.collection.stats



来源:https://stackoverflow.com/questions/39345630/what-is-difference-between-size-and-storagesize-displayed-by-mongo-stats-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!