-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Index Maintenance, Sharding
-
Query
-
(copied to CRM)
In a sharded environment, a query like
{_id : {$in : [100, 200, 300, 400, 500, 600...]}}
should be re-written by mongos by first resolving each _id value to the containing shard then sending the corresponding sub-qery to the right shard (assuming that _id is the shard key).
For example, if 100, 300, 500 belong to shard1 and 200, 400, 600 belong to shard2 MongoS should make exactly 2 queries:
{_id : {$in : [100, 300, 500]}}
to shard1
and
{_id : {$in : [200, 400, 600]}}
to shard2.
- duplicates
-
SERVER-1007 rewrite $in queries on shard key to only include keys on each shard
- Backlog
- is duplicated by
-
SERVER-9205 MongoS does not re-write $in queries which results in all terms in $in array being sent to all shards
- Closed
- is related to
-
SERVER-4960 Optimize shard selection on $in queries
- Backlog