How to separate mongodb data files from the journal?

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

Was this solution helpful to you?

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

Just Added Q & A:

Find solution

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.