I just want to understand why MongoDB uses that much disk space or even better would be to possibly reduce it.
The following is just an example. I have a storageSize of 1,35GB (includes dataSize + preallocated space), the index size is about 0,5GB, sums up to roughly 2GB. I know that mongodb allocates 2GB files, so you could loose some space there, but how is it possible to use 6GB of file size? Padding is set to 1, actually it’s just once written data, never any deletes or updates. Is there any possibility to reduce the file size?
In my case, MongoDB uses 6 times more space than my traditional SQL solution. I really want to use MongoDB, but I need to find a way to reduce diskspace. Thank you!
> db.stats(1024*1024)
{
"db" : "data",
"collections" : 4345,
"objects" : 9328910,
"avgObjSize" : 67.95158105287756,
"dataSize" : 604,
"storageSize" : 1350,
"numExtents" : 6480,
"indexes" : 8686,
"indexSize" : 511,
"fileSize" : 6078,
"nsSizeMB" : 16,
"ok" : 1
}
note: “data” is the only database in use in this stats
what I didn’t understand was that it in unix systems, mongodb does not just preallocate the current file, but also the NEXT file which can result in 2+2=4GB total preallocation…