© Guy Harrison, Michael Harrison 2021
G. Harrison, M. HarrisonMongoDB Performance Tuninghttps://doi.org/10.1007/978-1-4842-6879-7_5

5. Indexing

Guy Harrison1   and Michael Harrison2
(1)
Kingsville, VIC, Australia
(2)
Derrimut, VIC, Australia
 

An index is a database object with its own storage that provides a fast access path into a collection. Indexes exist primarily to enhance performance, so understanding and using indexes effectively is of paramount importance when optimizing MongoDB performance.

B-Tree Indexes

The B-tree (“balanced tree”) index is MongoDB’s default index structure. Figure 5-1 shows a high-level overview of the B-tree index structure.
Figure 5-1

B-tree index structure

The B-tree index has a hierarchical tree structure. At the top of the ...

Get MongoDB Performance Tuning: Optimizing MongoDB Databases and their Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.