[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 Created: 11/Apr/13  Updated: 06/Dec/22  Resolved: 10/Nov/17

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

Type: Improvement Priority: Major - P3
Reporter: Spencer Brody (Inactive) Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 10
Labels: graphquery
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
duplicates SERVER-1007 rewrite $in queries on shard key to o... Backlog
is duplicated by SERVER-9205 MongoS does not re-write $in queries ... Closed
Related
is related to SERVER-4960 Optimize shard selection on $in queries Backlog
Assigned Teams:
Query
Participants:
Case:

 Description   

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.



 Comments   
Comment by Asya Kamsky [ 06/Sep/17 ]

This looks like a duplicate of SERVER-1007

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