<slide>
<title>How does MongoDB pick an index?</title>

<list>
	<bullet>MongoDB does not keep cardinality statistics</bullet>
	<bullet>MongoDB tries all the possible indexes</bullet>
	<bullet>When it has found the fastest one, it remembers it</bullet>
	<bullet>MongoDB will re-try plans once in a while</bullet>
	<bullet>Indexes can be "hinted":
<example>
db.cities.createIndex( { population: 1, elevation: 1 } );
db.cities.createIndex( { elevation: -1 } );
db.cities.find( { population: { $gte: 2000000 }, elevation: { $gte : 1654 } })
         .sort( { elevation: -1 } )
         .hint( { elevation: -1 } );</example>
</bullet>
</list>
</slide>
