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

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.

主站蜘蛛池模板: 上蔡县| 黎城县| 石楼县| 鄂州市| 长春市| 澄江县| 集贤县| 赫章县| 衡水市| 定南县| 新宁县| 清涧县| 延边| 东辽县| 洛阳市| 青铜峡市| 镇远县| 昭通市| 庄浪县| 珲春市| 平度市| 金溪县| 九江市| 沅陵县| 湖南省| 五莲县| 将乐县| 临江市| 泰宁县| 柳河县| 舟曲县| 稻城县| 张家港市| 巴林左旗| 达尔| 丰城市| 专栏| 安康市| 子洲县| 陆丰市| 康平县|