-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Sharding
-
None
In sharded environment, a query like
{_id : {$in : [100, 200, 300, 400, 500, 600...]}}
needs to be re-written by mongos by first resolving each _id value to the shard based on shard key (provided the shard key can be deduced from the query) and then sending corresponding sub-qery to the right shard.
Example, if 100, 300, 500 belong to shard1 and 200, 400, 600 belong to shard2 MongoS needs to make exactly 2 queries:
{_id : {$in : [100, 300, 500]}}
to shard1
and
{_id : {$in : [200, 400, 600]}}
to shard2.
- duplicates
-
SERVER-4960 Optimize shard selection on $in queries
- Backlog
-
SERVER-9332 Mongos should re-write $in queries on the shard key before sending them to the shards so that the shards only receive the relevant portion of the $in
- Closed