Set up the environment using the following:
for (var i = 0; i < 1000; i++) { db.foo.insert({x: {a: 'y', b: [i, 3*i, "wassup yo"]}}); } db.foo.ensureIndex({a:1, b:1})
In 2.4.6, performant behavior:
> db.foo.find({'a': 'y', 'b': 244}).explain()
{
"cursor" : "BtreeCursor a_1_b_1",
"isMultiKey" : true,
"n" : 2,
"nscannedObjects" : 2,
"nscanned" : 2,
"nscannedObjectsAllPlans" : 2,
"nscannedAllPlans" : 2,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"a" : [
[
"y",
"y"
]
],
"b" : [
[
244,
244
]
]
},
"server" : "Kestrel.local:27017"
}
In 2.5.5-pre-, huge slowdown:
> db.foo.find({'a': 'y', 'b': 244}).explain()
{
"cursor" : "BtreeCursor a_1_b_1",
"isMultiKey" : true,
"n" : 1,
"nscannedObjects" : 1000,
"nscanned" : 2999,
"nscannedObjectsAllPlans" : 1099,
"nscannedAllPlans" : 3098,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 23,
"nChunkSkips" : 0,
"millis" : 7,
"indexBounds" : {
"a" : [
[
"y",
"y"
]
],
"b" : [
[
{
"$minElement" : 1
},
{
"$maxElement" : 1
}
]
]
},
"server" : "Kestrel.local:27017"
}
It's unclear which of these we should expect to see, based on SERVER-7959 and other incidents. However, the performance slowdown is going to surprise a lot of users. (Also, pretty sure that the functionality we use is encouraged by our docs/training.)
However, not 100% sure if the 2.4.6 functionality lost results. Bears further investigation.
- is related to
-
SERVER-12470 document and audit multikey bounds behavior
-
- Closed
-