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

Mongos find query including upper bound X of a chunk also targets the shard with chunk having lower bound = X

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.6, 3.0.6, 3.1.8
    • Component/s: Querying, Sharding
    • None
    • Query Optimization
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Chunks are inclusive at the lower bound and exclusive at the upper bound.

      However, find queries over a range of the form

      { $lt : X }

      where X is the upper bound of a chunk also targets the shard containing the chunk whose lower bound is X (at least according to find().explain()).

      Note that a point query for X will only (and correctly) target the shard with the chunk whose lower bound is X.
      Similarly, a query of the form

      { $lte : X }

      will (correctly) target the shard for both chunks.

      This is undesirable both from a performance perspective, since an additional shard is unnecessarily targeted in this situation, and a testing perspective, since .explain() cannot be used to verify that all documents within a chunk's range lie only on the shard the chunk is expected to be on.

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated: