Compressed suffix array G • Grid (spatial index) I • Incremental encoding • Database index • Indexed file I cont. • Inverted index K • K-d tree M • M-tree O • Octree P • Priority R-tree Q • Quadtree R cont. • R* tree • R+ tree • Reverse index S • Substring index U • UB-tree X • X-tree Z • Z-order curve
index only when the query only involves keys which are present in the index. Not inspecting the actual documents can speed up responses considerably since the index is compact in size and usually fits in RAM, or is sequentially located on disk. • Sparse + Unique Index You can combine sparse with unique to produce a unique constraint that ignores documents with missing fields.
index per collection, for now • In compound index geospatial part should be first • Sharding on a geo-key isn't recommended MongoDB can't use two-dimensional index to route queries • Operation $near is not working on sharded collection Use "getNear" command rather than $near
values in index to calculate its value. Sometime it can takes too much time • "Count" ignores ordering Actual count of retrieved documents can be different than result of "cont" operation: db.t.save({x:1}) db.t.save({x:1,y:2}) db.t.save({x:1,y:3}) db.t.find().sort({y:1}).toArray().length // 2 db.t.find().sort({y:1}).count() // 3
a query from the database db.coll.find({...}).explain() • Dex, the Index Bot Dex is a MongoDB performance tuning tool that compares queries to the available indexes in the queried collection(s) and generates index suggestions based on simple heuristics.