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

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.

主站蜘蛛池模板: 屏边| 内丘县| 盖州市| 阿拉尔市| 清水河县| 文水县| 修文县| 济源市| 西丰县| 临夏县| 河池市| 太湖县| 达拉特旗| 雷州市| 称多县| 高邮市| 丹东市| 金川县| 怀来县| 新津县| 通辽市| 博客| 电白县| 筠连县| 尼勒克县| 将乐县| 无棣县| 湄潭县| 丹巴县| 班戈县| 留坝县| 射洪县| 当阳市| 巫山县| 彭州市| 古丈县| 西吉县| 泾川县| 武鸣县| 巢湖市| 闽清县|