[SERVER-9205] MongoS does not re-write $in queries which results in all terms in $in array being sent to all shards Created: 01/Apr/13  Updated: 31/Jan/14  Resolved: 01/Apr/13

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Antoine Girbal Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-4960 Optimize shard selection on $in queries Backlog
duplicates SERVER-9332 Mongos should re-write $in queries on... Closed
Participants:

 Description   

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.



 Comments   
Comment by Antoine Girbal [ 01/Apr/13 ]

hey Eliot, just note that the new ticket is more about filtering the $in
list rather than just selecting the right shards.
From talking to Greg, sounds like at this time we dont query the shards
that dont have any related data, so part of.SERVER-4960 is already
implemented
thanks

{ name : "Girbal Antoine", title : "Technical Account Manager Lead", phone : "408.355.0767", location : "Palo Alto, CA", twitter : ["@MongoDB", "@10gen"], facebook : ["MongoDB", "10gen"] }
Comment by Eliot Horowitz (Inactive) [ 01/Apr/13 ]

SERVER-4960

Generated at Thu Feb 08 03:19:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.