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

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

      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
      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

            dave.cuthbert@mongodb.com Dave Cuthbert (Inactive)
            harshad.dhavale@mongodb.com Harshad Dhavale
            6 Vote for this issue
            14 Start watching this issue

              2 years, 6 weeks, 4 days ago