May 02, 2013

Mongo Query

from Optimizing MongoDB Compound Indexes  

  •  For indexed queries
    • nscanned: the number of index keys in the range that Mongo scanned
    • nscannedObjects: the number of documents it looked at to get the final result
    • n: matched documents
  • "optimal index" for a query
    • include all the query's filtered fields and sort fields
    • any range-filtered or sort fields in the query must come after equality fields
    • if there are multiple optimal indexes, Mongo chooses one arbitrarily

No comments: