The shard targeting process is fairly heavy-weight. It involves running all query planning logic using QueryPlanner::plan(), and then analyzing the plan to determine the shard key ranges represented by the query.
For the special case of equality on the shard key, we don't have to plan the entire query. Instead, we can simply extract the shard key value from the query, look up the corresponding chunk, and determine the shard on which that chunk resides. Performance testing has shown an overall performance benefit of 6-7% associated with this change for equality-on-shardkey queries.
- is related to
-
SERVER-20596 Performance regression in new mongos query path (about 17% worse than 3.0)
- Closed