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

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.2.6, 3.0.6, 3.1.8
    • Component/s: Querying, Sharding
    • None
    • Query Optimization
    • None
    • 3
    • 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:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            Esha Maharishi (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated: