Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-21441

Optimize shard targeting for equality queries on the shard key

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.2.0-rc4
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • QuInt C (11/23/15)

      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.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: