How ot tell if Index is usefull in Mongodb
Index is usefull if the query you are running uses it.
> db.score.find({_id:10}).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "movie.score",
"indexFilterSet" : false,
"parsedQuery" : {
"_id" : {
"$eq" : 10
}
},
"winningPlan" : {
"stage" : "IDHACK"
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "sikki4u1c.mylabserver.com",
"port" : 27017,
"version" : "3.6.13",
"gitVersion" : "db3c76679b7a3d9b443a0e1b3e45ed02b88c539f"
},
"ok" : 1
}
>
> db.score.find({_id:10}).explain()
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "movie.score",
"indexFilterSet" : false,
"parsedQuery" : {
"_id" : {
"$eq" : 10
}
},
"winningPlan" : {
"stage" : "IDHACK"
},
"rejectedPlans" : [ ]
},
"serverInfo" : {
"host" : "sikki4u1c.mylabserver.com",
"port" : 27017,
"version" : "3.6.13",
"gitVersion" : "db3c76679b7a3d9b443a0e1b3e45ed02b88c539f"
},
"ok" : 1
}
>
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home