[SERVER-7152] estimating document size for storage Created: 25/Sep/12 Updated: 11/Jul/16 Resolved: 15/Jan/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Storage |
| Affects Version/s: | 2.0.3 |
| Fix Version/s: | None |
| Type: | Question | Priority: | Minor - P4 |
| Reporter: | Shanthi Nellaiappan | Assignee: | Scott Hernandez (Inactive) |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Participants: |
| Description |
|
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? , On creating a document with int, the avgObjSize is 32 bytes. , 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.stats(); , |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 25/Sep/12 ] | ||||||||
|
As Tad said, you can see the definition for the storage format of documents here: http://bsonspec.org/#/specification You can also use Object.bsonsize(<doc>) to get the size of any document/object.
To estimate the indexes and actual storage size you will probably want to create a bunch of data and extrapolate based on the numbers. | ||||||||
| Comment by Tad Marshall [ 25/Sep/12 ] | ||||||||
|
You can use mongodump to export this document to a BSON file and examine it in a hex editor. See http://bsonspec.org for the BSON specification. |