Details
-
Improvement
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
None
-
None
-
ServerDocs2022: Apr5 - Apr12, ServerDocs2022: Mar29 - Apr5, ServerDocs2022: Apr12 - Apr19
-
(copied to CRM)
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