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

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.

主站蜘蛛池模板: 惠东县| 抚宁县| 滦南县| 四川省| 德州市| 昆山市| 宿松县| 肇州县| 长春市| 兴安县| 社旗县| 砀山县| 临洮县| 鹤山市| 汝州市| 咸宁市| 泽库县| 洞头县| 纳雍县| 峡江县| 麻阳| 茂名市| 禄丰县| 承德县| 丽江市| 梨树县| 宁河县| 吉水县| 高密市| 临武县| 镇安县| 大悟县| 花垣县| 武宣县| 柳江县| 宝兴县| 平江县| 武平县| 东阳市| 辽中县| 徐水县|