-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
on sharding cluster , if:
- the query will hit only shard (query with shardkey)
- query with large skip
mongos will ask mongod to reply all the matched records, and do skip on mongos. which is not efficient because no INDEX is used. and too much data is transfer between mongod and mongos
see this explain:
mongos> db.test_collection.find({'_uid': 500}).skip(1000).limit(5).explain() { "clusteredType" : "ParallelSort", "shards" : { "set_test_2/10.65.16.245:7611,10.65.19.26:7611,10.65.19.52:7611" : [ { "cursor" : "BtreeCursor _uid_1", "n" : 1005, //useless "nscannedObjects" : 1005, "nscanned" : 1005, "nscannedObjectsAllPlans" : 1005, "nscannedAllPlans" : 1005, }, "server" : "xxxxxxxx:7611" } ] }, ...... }
we can just pass the query to the shard like what we did on not-sharded collection.
- related to
-
SERVER-41329 Improve skip performance in mongos when request is sent to a single shard
- Closed
- links to