mongodb - mongdb index does not work properly -
environment
10.10.109.131:23000 => shard000 10.10.109.131:23001 => shard001 10.10.111.251:23000 => shard000 10.10.111.251:23001 => shard001 10.10.97.197:23000 => shard000 10.10.97.197:23001 => shard001
phenomenon
view abnormally high in system.profile table scan, explain query again found table scan return normal
issue sql:
db.followers.find({"$and":[{"$or":[{"vaild":0},{"vaild":null}]},{"from":{"$in":[576893,2095602,1184292,650082,1373126,875232,815151,556585,1391458,813307,600211,2273636,106322,2206656,804217]}},{"to":1600312},{"$or":[{"vaild":null},{"vaild":0}]}]})
system.profile
"op" : "query", "ns" : "chuyesocial.followers", "query" : { ... }, "ntoreturn" : 0, "ntoskip" : 0, "nscanned" : 424277, "nscannedobjects" : 424263,
explain
shard001:primary> db.followers.find({"$and":[{"$or":[{"vaild":0},{"vaild":null}]},{"from":{"$in":[576893,2095602,1184292,650082,1373126,875232,815151,556585,1391458,813307,600211,2273636,106322,2206656,804217]}},{"to":1600312},{"$or":[{"vaild":null},{"vaild":0}]}]}).explain() { "queryplanner" : { "plannerversion" : 1, "namespace" : "chuyesocial.followers", "indexfilterset" : false, "parsedquery" : { ... }, "executionstats" : { "executionsuccess" : true, "nreturned" : 13, "executiontimemillis" : 4, "totalkeysexamined" : 17, "totaldocsexamined" : 17, "executionstages" : { "stage" : "keep_mutations", "nreturned" : 13, "executiontimemillisestimate" : 0, "works" : 20, "advanced" : 13, "needtime" : 4, "needfetch" : 1, "savestate" : 5, "restorestate" : 5, "iseof" : 1, "invalidates" : 0, } } }
index information
"_id_" : 37486960, "from_1__id_1" : 69896624, (sharedkey) "to_1" : 37560544
other :there 2 machines in cluster cpu 100% of cases
Comments
Post a Comment