[DOCS-3683] Provide methodological way of thinking about indexes Created: 30/Jun/14  Updated: 11/Jan/17  Resolved: 27/Jul/16

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: 01112017-cleanup

Type: Task Priority: Major - P3
Reporter: David Hows Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:
Days since reply: 7 years, 29 weeks ago

 Description   

Currently we cover off a few finite examples of how to build indexes for certain kinds of queries. Support regularly recommend reading the following blog post by Jesse to many of our customers as it contains some stellar thinking and a great methodology:
http://emptysqua.re/blog/optimizing-mongodb-compound-indexes/#method

Can we add a new document which explains how to think about building indexes for particular families of queries and (assuming Jesse is okay with it) provides his suggested method for thinking about indexes:

  1. Equality Tests
    1. Add all equality-tested fields to the compound index, in any order
  2. Sort Fields (ascending / descending only matters if there are multiple sort fields)
    1. Add sort fields to the index in the same order and direction as your query's sort
  3. Range Filters
    1. First, add the range filter for the field with the lowest cardinality (fewest distinct values in the collection)
    2. Then the next lowest-cardinality range filter, and so on to the highest-cardinality


 Comments   
Comment by Emily Hall [ 27/Jul/16 ]

Closed for housekeeping on 7/27/2016 by Emily Hall.
If you require additional support, please open a new ticket for prioritization.
Thanks,
Emily

Generated at Thu Feb 08 07:46:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.