Why might a MongoDB database be many times bigger than the data stored?
-
I'm testing MongoDB using MongoHQ. My database with 2 records is 2.5MB รข much larger than the data stored. If I execute db.printCollectionStats() against each collection, I get the output: Property { "ns" : "Properties.Property", "count" : 1, "size" : 24, "avgObjSize" : 24, "storageSize" : 256, "numExtents" : 1, "nindexes" : 1, "lastExtentSize" : 256, "paddingFactor" : 1, "flags" : 1, "totalIndexSize" : 8192, "indexSizes" : { "_id_" : 8192 }, "ok" : 1 } --- fs.chunks { "ns" : "Properties.fs.chunks", "count" : 2, "size" : 284060, "avgObjSize" : 142030, "storageSize" : 2733312, "numExtents" : 2, "nindexes" : 2, "lastExtentSize" : 2725120, "paddingFactor" : 1, "flags" : 1, "totalIndexSize" : 16384, "indexSizes" : { "_id_" : 8192, "files_id_1_n_1" : 8192 }, "ok" : 1 } --- fs.files { "ns" : "Properties.fs.files", "count" : 0, "size" : 0, "avgObjSize" : NaN, "storageSize" : 8192, "numExtents" : 1, "nindexes" : 2, "lastExtentSize" : 8192, "paddingFactor" : 1, "flags" : 1, "totalIndexSize" : 16384, "indexSizes" : { "_id_" : 8192, "filename_1_uploadDate_-1" : 8192 }, "ok" : 1 } --- system.indexes { "ns" : "Properties.system.indexes", "count" : 6, "size" : 484, "avgObjSize" : 80.66666666666667, "storageSize" : 4352, "numExtents" : 1, "nindexes" : 0, "lastExtentSize" : 4352, "paddingFactor" : 1, "flags" : 0, "totalIndexSize" : 0, "indexSizes" : { }, "ok" : 1 } --- system.users { "ns" : "Properties.system.users", "count" : 1, "size" : 92, "avgObjSize" : 92, "storageSize" : 8192, "numExtents" : 1, "nindexes" : 1, "lastExtentSize" : 8192, "paddingFactor" : 1, "flags" : 1, "totalIndexSize" : 8192, "indexSizes" : { "_id_" : 8192 }, "ok" : 1 }
-
Answer:
Here is the reason explained in the MongoDB site Excesive Disk Space: http://www.mongodb.org/display/DOCS/Excessive+Disk+Space
Ezequiel Erbaro at Quora Visit the source
Other answers
Mongo stores data files are splited in 2Mb chunks. For performance reasons Mongo preallocates entire 2Mb space for each new chunk file.
Bogdan Sulima
Related Q & A:
- Is there any way of seeing how many times a Wikipedia page has been viewed?Best solution by Yahoo! Answers
- Is there a limit of how many times one can study abroad?Best solution by Yahoo! Answers
- Why might a unitary government be more successful in a country like Japan than the US?Best solution by chacha.com
- Why might assimilation not be achieved in a capitalist society?Best solution by encyclopedia.com
- How many times can you Tweet a day?Best solution by ChaCha
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.