-
Type:
Bug
-
Resolution: Incomplete
-
Priority:
Major - P3
-
None
-
Affects Version/s: 2.6.3, 2.6.4
-
Component/s: Geo
-
None
-
ALL
-
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
geoIntersect queries are getting very long to complete (~1300ms) against a collection with 5530 polygons / multi polygons (154.41mb)
The query generally returns 2 or 3 documents.
Sample Query:
db.locations.find({"l": {"$geoIntersects": {"$geometry": {"type": "Point", "coordinates": [-47.81302261352539, -21.18204307556152]}}}}, {"m":1,"s":1,"n":1, "c":1})
Query Explain Output:
{ "cursor" : "BtreeCursor l_2dsphere", "isMultiKey" : true, "n" : 2, "nscannedObjects" : 2, "nscanned" : 5, "nscannedObjectsAllPlans" : 2, "nscannedAllPlans" : 5, "scanAndOrder" : false, "indexOnly" : false, "nYields" : 1, "nChunkSkips" : 0, "millis" : 1368, "indexBounds" : { "l" : [ [ "4f2211303", "4f2211303" ], [ "4f22113031", "4f22113031" ], [ "4f221130313", "4f221130313" ], [ "4f2211303133", "4f2211303133" ], [ "4f22113031331", "4f22113031332" ] ] }, "server" : "c0:27017", "filterSet" : false }
Collection Stats:
{
ns: "pinion.locations",
count: 5530,
size: 80728672,
avgObjSize: 14598,
storageSize: 161910784,
numExtents: 4,
nindexes: 4,
lastExtentSize: 90599424,
paddingFactor: 1,
systemFlags: 1,
userFlags: 1,
totalIndexSize: 11250176,
indexSizes: {
_id_: 188048,
l_2dsphere: 10358992,
t_1: 335216,
n_1: 367920
},
ok: 1
}
Collection Indexes:
[ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "pinion.locations" }, { "v" : 1, "key" : { "l" : "2dsphere" }, "name" : "l_2dsphere", "ns" : "pinion.locations", "background" : true, "safe" : true, "2dsphereIndexVersion" : 2 }, { "v" : 1, "key" : { "t" : 1 }, "name" : "t_1", "ns" : "pinion.locations", "background" : true, "safe" : true }, { "v" : 1, "key" : { "n" : 1 }, "name" : "n_1", "ns" : "pinion.locations", "background" : true, "safe" : true } ]
The documents are large polygon areas like states, districts and municipalities.
Some are regular Polygons, other are MultiPolygons.
The database is running on a Replica Set managed by Compose.io (ex MongoHQ) with a lot of idle hardware.
I have MMS monitoring enabled should more stats are needed.
Locks and Queues are very very low, all other queries returns very fast, including geoNear queries on other collections.