开发者

MongoDb : Avoid excessive disk space

I am having a database which has been allocated a space of 85GB. I got this size using the show dbs command. But when I use the db.stats(), i get the storage size as 63GB. After going thro开发者_StackOverflow社区ugh the docs I found dat mongo db allocates a size to the db that is created and then the actual data is filled.

Why does mongo does this preallocation and is there a way I can avoid this preallocation ?

If Yes, will it be a good idea to do it or it is going to affect from performance point of view ?

Thanks!!!


Details can be found here: http://www.mongodb.org/display/DOCS/Excessive+Disk+Space

Now to your case. I think that the current size of your datafiles cannot be caused by preallocation alone. The maximum size of allocated data files is 2G. Maybe you once stored much more data than today? The link above also shows how to reclaim this data if you're sure you will not need it soon anyway. This will require a lot of disk space during the process, so you must give this some planning.

Disabling preallocation will indeed have perfomance impact. When you do many inserts, the process would regularly have to wait to create a new file.


You can disable preallocation with the --noprealloc command line parameter.


You can read more here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜