官术网_书友最值得收藏!

compact

MongoDB documents take up a specified amount of space on disk. If we perform an update that increases the size of a document this may end up being moved out of sequence to the end of the storage block, creating a hole in storage, resulting in increased execution times for this update, and possibly missing it from running queries. The compact operation will defragment space resulting in less space being used.

compact can also take a paddingFactor argument as follows:

> db.runCommand ( { compact: '<collection>', paddingFactor: 2.0 } )

paddingFactor is preallocated space in each document that ranges from 1.0 (no padding, the default value) to 4.0 for calculated padding of 300 bytes for each 100 bytes of document space needed when we initially insert it.

Adding padding can help alleviate the problem of updates moving documents around, at the expense of more disk space being needed for each document when created.

主站蜘蛛池模板: 开远市| 昌都县| 岳池县| 金昌市| 扎囊县| 沈丘县| 邵武市| 西丰县| 辛集市| 洱源县| 故城县| 利辛县| 汉阴县| 张家港市| 巨鹿县| 永登县| 正定县| 波密县| 宜川县| 安平县| 贺兰县| 东台市| 万源市| 南丰县| 大理市| 石泉县| 阳信县| 文登市| 宝山区| 饶阳县| 壤塘县| 延津县| 奉贤区| 陈巴尔虎旗| 盘锦市| 万荣县| 屯门区| 清徐县| 雷波县| 繁昌县| 邻水|