Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-7152

estimating document size for storage

    • Type: Icon: Question Question
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.0.3
    • Component/s: Storage
    • None

      We are trying to estimate the storage size for a given schema ..

      On creating just a single document in a collection with only one attribute of type long results in avgObjSize of 36 bytes. What is the break up for this 36?
      PRIMARY> db.test64Long.stats()
      {
      "ns" : "quad.test64Long",
      "count" : 1,
      "size" : 36,
      "avgObjSize" : 36,
      "storageSize" : 4096,
      "numExtents" : 1,
      "nindexes" : 1,
      "lastExtentSize" : 4096,
      "paddingFactor" : 1,
      "flags" : 1,
      "totalIndexSize" : 8176,
      "indexSizes" :

      { "_id_" : 8176 }

      ,
      }
      PRIMARY> db.test64Long.findOne();

      { "_id" : ObjectId("5061db7f77eee6137922f6cf"), "key" : NumberLong(12345) }

      On creating a document with int, the avgObjSize is 32 bytes.
      PRIMARY> db.testInt.stats();
      {
      "ns" : "quad.testInt",
      "count" : 1,
      "size" : 32,
      "avgObjSize" : 32,
      "storageSize" : 4096,
      "numExtents" : 1,
      "nindexes" : 1,
      "lastExtentSize" : 4096,
      "paddingFactor" : 1,
      "flags" : 1,
      "totalIndexSize" : 8176,
      "indexSizes" :

      { "_id_" : 8176 }

      ,
      "ok" : 1
      }
      PRIMARY> db.testInt.findOne();

      { "_id" : ObjectId("5061df0777eee6137922f6d4"), "key" : 1234 }

      On creating a document with an array of just one element of type long, the avgObjSize 44. What is the break up for 44 bytes.
      PRIMARY> db.testAr2.findOne();

      { "_id" : ObjectId("5061dde977eee6137922f6d3"), "key" : [ 123456 ] }

      PRIMARY> db.testAr2.stats();
      {
      "ns" : "quad.testAr2",
      "count" : 1,
      "size" : 44,
      "avgObjSize" : 44,
      "storageSize" : 4096,
      "numExtents" : 1,
      "nindexes" : 1,
      "lastExtentSize" : 4096,
      "paddingFactor" : 1,
      "flags" : 1,
      "totalIndexSize" : 8176,
      "indexSizes" :

      { "_id_" : 8176 }

      ,
      "ok" : 1
      }

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            nshanthi@cisco.com Shanthi Nellaiappan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: