Shard targeting for queries with geo predicates

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.2.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • QO 2021-11-01, QO 2021-11-15, QO 2021-11-29
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      The ticket (in the comments) describes a query which combines a btree index with a 2d index. We currently do not believe we are performing shard targeting for geo queries (see comments for code).

       

      This ticket will involve improve the geo targeting in the presence of regular equality predicates. In essence, if we can target based on regular equalities, we should also carry that targeting when we add additional conjunctions to the query (2d or other).

       

       

      use test
       db.test.createIndex(
      { "adminOrder.country": 1, "platformProperties.deliveryID": 1, "_id":1 }
      )
       db.test.createIndex(
      {geometry: "2dsphere"}
      )
       sh.shardCollection("test.test",
      { "adminOrder.country": 1, "platformProperties.deliveryID": 1, "_id":1 }
      )

       

      db.test.find(
      {"adminOrder.country":"USA"}
      ).explain('executionStats')
      

       

      db.test.find({'adminOrder.country':'USA', geometry:{ $near :{$geometry:
      { type: "Point", coordinates: [-122.41284419999998, 47.1478758] }
      ,$minDistance: 0,$maxDistance: 10}}}).explain('executionStats')

            Assignee:
            Katherine Wu (Inactive)
            Reporter:
            Svilen Mihaylov (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved: