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

[SERVER] Adding Equality-Sort-Range info to index documentation

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • None
    • manual, Server
    • None
    • ServerDocs2022: Apr5 - Apr12, ServerDocs2022: Mar29 - Apr5, ServerDocs2022: Apr12 - Apr19
    • true

    Description

      Currently, our documentation does not have information that specifically talks about designing indexes using the Equality-Sort-Range rule. The online trainings talk about the E-S-R rule in depth, however the docs do not mention it.

      It would be nice to add a blurb like this one, to our index documentation:

      The optimal index for a given query can usually be found with the equality-sort-range rule, which 
      indicates that in an index, the equality fields should be first, then the sort fields, and finally the range
      fields.
      So, for example, let's consider this query: db.test.find({a:'x', b: {$gt: 10}}).sort(}}{{{c:1}}}
      Here, `a` is an equality based match, `b` is a range based match, and `c` is used for sorting. Following 
      the equality-sort-range rule, the most optimal index for the above query will be: `{a:1, c:1, b:1}`
      

      Scope of Changes

      • A new page or section possibly under Indexing Strategies to cover ESR
      • Need to frame carefully as a guideline and not an all-encompassing rule

      Attachments

        Activity

          People

            dave.cuthbert@mongodb.com Dave Cuthbert
            harshad.dhavale@mongodb.com Harshad Dhavale
            Dave Cuthbert Dave Cuthbert
            Votes:
            6 Vote for this issue
            Watchers:
            14 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              10 weeks, 3 days ago