[SERVER-53718] Shard targeting for queries with geo predicates Created: 12/Jan/21  Updated: 29/Oct/23  Resolved: 15/Nov/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.2.0

Type: Bug Priority: Major - P3
Reporter: Svilen Mihaylov (Inactive) Assignee: Katherine Wu (Inactive)
Resolution: Fixed Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QO 2021-11-01, QO 2021-11-15, QO 2021-11-29
Participants:
Case:

 Description   

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')



 Comments   
Comment by Githook User [ 12/Nov/21 ]

Author:

{'name': 'Katherine Wu', 'email': 'katherine.wu@mongodb.com', 'username': 'kaywux'}

Message: SERVER-53718 Enable shard targeting for other predicates in presence of $geoNear
Branch: master
https://github.com/mongodb/mongo/commit/263fb87afa29269f365a208e76000ba429e4ee41

Comment by David Percy [ 15/Oct/21 ]

I wonder whether this also happens with the $geoNear aggregation stage.

Generated at Thu Feb 08 05:31:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.