[SERVER-14381] Slow $geoIntersects on MultiPoint Created: 28/Jun/14  Updated: 07/Nov/14  Resolved: 07/Nov/14

Status: Closed
Project: Core Server
Component/s: Geo, Querying
Affects Version/s: 2.6.3
Fix Version/s: None

Type: Improvement Priority: Critical - P2
Reporter: ldsenow Assignee: Thomas Rueckstiess
Resolution: Incomplete Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

I am experiencing very slow performance on a MultiPoint field with 2dsphere index.

My document structure is:

{
    _id: 'anything',
    locs: {  //2dsphere indexed
       "type" : "MultiPoint",
        "coordinates" : [ 
            [ x1, y1 ], 
            [ x2, y2],
            ...
        ]
   }
}

I have 10m records of the above documents and I am using $geoIntersects like below to find matched docs out:

db.collection.find({
    "locs" : {
            "$geoIntersects" : {
                    "$geometry" : {
                        "type" : "Polygon",
                        "coordinates" : [ 
                            [ 
                                [ 
                                    151.1953097969488, 
                                    -33.87301779694879
                                ], 
                                [ 
                                    151.2171042030512, 
                                    -33.87301779694879
                                ], 
                                [ 
                                    151.2171042030512, 
                                    -33.89481220305122
                                ], 
                                [ 
                                    151.1953097969488, 
                                    -33.89481220305122
                                ], 
                                [ 
                                    151.1953097969488, 
                                    -33.87301779694879
                                ]
                            ]
                        ]
                    }
                }
            }
});

It takes 20s to return 700 records which is extremely slow. So I did test on making the MultiPoint filed to a Point (just take the first one in the MultiPoint aray and also 2dsphere indexed) field.

So my doc structure is

{
    _id: 'anything',
    locs: {  //2dsphere indexed
       "type" : "Point",
        "coordinates" :  [ x1, y1 ] 
   }
}

and then run the same query again. Surprisingly, it returns really fast (less than100ms).

Would anyone give me a hint or walk around before MongoDb team fixes it?



 Comments   
Comment by Ramon Fernandez Marina [ 07/Nov/14 ]

Hi ldsenow , we haven’t heard back from you for some time, so I’m going to mark this ticket as resolved. If this is still an issue for you, feel free to re-open the ticket and provide additional information as requested above.

Regards,
Ramón.

Comment by Thomas Rueckstiess [ 05/Aug/14 ]

Hi,

I haven't heard back from you in some time. Have you had a chance to review my questions? I'd still need more information to diagnose the issue further.

Thanks,
Thomas

Comment by Thomas Rueckstiess [ 30/Jun/14 ]

Hi ldsenow,

I've set up a similar dataset to what you describe (although with only 1 million documents) and I can't reproduce the issue so far. The queries are still very fast (20ms in my test).

Can you please provide some more information?

  1. The full explain output of the query, for both the MultiPoint and Point datasets? You can get the explain output by appending .explain(true) to the end of the find().
  2. The stats of the collection, which you can get with db.collection.stats(), again for both the MultiPoint and Point datasets if possible.
  3. A few example documents of the MultiPoint dataset. You can get that with db.collection.find().limit(3)
  4. Are all your points very close together? Or do they cover the entire globe?

This will hopefully give me enough information to reproduce the issue.

Thanks,
Thomas

Generated at Thu Feb 08 03:34:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.