Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-2918

Re-word index key size description

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: v1.3.2
    • Component/s: manual
    • Last comment by Customer:
      true
    • Actual Time:
      4

      Description

      http://docs.mongodb.org/master/reference/limits/#Index Key

      I recently learned that the v1 index key size is only stored as bson when the string length is > 255. Let's figure out a way to make this description helpful without digging too far into the weeds of what the size is...

      The total size of an index key entry must be less than 1024 bytes. The total size includes the following overhead:
       
      5 bytes for the BSON document structure,
      1 byte for type specification for each field in the index key,
      any additional representation overhead for each field in the index key.
      For example, a string has a representation overhead of 5 bytes: 1 byte for the null terminator plus the 4 bytes to specify the length of the string including the terminator. Then, for an index on a string field, the indexed field value must be less than 1013 bytes. For a compound index on two string fields, because each field adds 6 bytes of overhead (1 for type specification and 5 for representation) as well as the 5 bytes for the BSON document structure, the key size must be less than 1007.

        Attachments

          Activity

            People

            Assignee:
            kay.kim Kay Kim (Inactive)
            Reporter:
            pasette Daniel Pasette
            Participants:
            Last commenter:
            Jonathan Dahl Jonathan Dahl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since reply:
              7 years, 32 weeks, 1 day ago
              Date of 1st Reply: