| Steps To Reproduce: |
- Generate data - 20K large objects and related 2d compound index
function generateData(count, uniqueAppIds) {
|
appIds = []
|
for (i = 0; i < uniqueAppIds; ++i) {
|
appIds[i] = ObjectId();
|
}
|
|
dummyx = new Array(10000);
|
dummyx = dummyx.join("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
|
|
for (i = 0; i < count; i++) {
|
doc = {
|
extra_s: dummyx,
|
xid: appIds[Math.round(Math.random() * 9)],
|
pos: [Math.round(Math.random() * 360) - 180, Math.round(Math.random() * 180) - 90]
|
};
|
db.places.insert(doc);
|
}
|
|
/* Ensure Indices */
|
db.places.ensureIndex({pos: "2d", xid: 1});
|
}
|
|
function generateData(20000, 100)
|
- drop vm cache
# on MacOS this would be
|
sudo purge
|
- Run the query that is expected to work fine
db.places.find({pos: { $nearSphere: [ 0, 0 ], $maxDistance: 125}, xid: ObjectId("547dbbe1290b9685990ca000"), xix: 1}).explain()
|
{
|
"cursor" : "GeoSearchCursor",
|
"isMultiKey" : false,
|
"n" : 0,
|
"nscannedObjects" : 0,
|
"nscanned" : 20000,
|
"nscannedObjectsAllPlans" : 0,
|
"nscannedAllPlans" : 20000,
|
"scanAndOrder" : false,
|
"indexOnly" : false,
|
"nYields" : 0,
|
"nChunkSkips" : 0,
|
"millis" : 88,
|
"indexBounds" : {
|
|
},
|
"server" : "aks-osx.local:37018",
|
"filterSet" : false
|
}
|
- Drop VM cache
- Run query that does wider object scan than intended
db.places.find({pos: { $nearSphere: [ 0, 0 ], $maxDistance: 125}, xid: ObjectId("547dbbe1290b9685990ca000"), cix: 1}).explain()
|
{
|
"cursor" : "GeoSearchCursor",
|
"isMultiKey" : false,
|
"n" : 0,
|
"nscannedObjects" : 20000,
|
"nscanned" : 20000,
|
"nscannedObjectsAllPlans" : 20000,
|
"nscannedAllPlans" : 20000,
|
"scanAndOrder" : false,
|
"indexOnly" : false,
|
"nYields" : 0,
|
"nChunkSkips" : 0,
|
"millis" : 13024,
|
"indexBounds" : {
|
|
},
|
"server" : "aks-osx.local:37018",
|
"filterSet" : false
|
}
|
|