Skip to content

Instantly share code, notes, and snippets.

@jeremyvdw
Created February 28, 2013 10:52
Show Gist options
  • Save jeremyvdw/5055886 to your computer and use it in GitHub Desktop.
Save jeremyvdw/5055886 to your computer and use it in GitHub Desktop.
> db.players.find( { team_id: { $in: ["phi"] } }).sort({last_name: 1}).explain()
{
"cursor" : "BtreeCursor team_id_1",
"isMultiKey" : false,
"n" : 37,
"nscannedObjects" : 37,
"nscanned" : 37,
"nscannedObjectsAllPlans" : 74,
"nscannedAllPlans" : 74,
"scanAndOrder" : true,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"team_id" : [
[
"phi",
"phi"
]
]
},
"server" : "xxxxxxx"
}
> db.players.ensureIndex({ team_id: 1, last_name: 1})
> db.players.find( { team_id: { $in: ["phi"] } }).sort({last_name: 1}).explain()
{
"cursor" : "BtreeCursor team_id_1_last_name_1",
"isMultiKey" : false,
"n" : 37,
"nscannedObjects" : 37,
"nscanned" : 37,
"nscannedObjectsAllPlans" : 37,
"nscannedAllPlans" : 37,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"team_id" : [
[
"phi",
"phi"
]
],
"last_name" : [
[
{
"$minElement" : 1
},
{
"$maxElement" : 1
}
]
]
},
"server" : "xxxxxxx"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment