-
Type:
Task
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: 2.5.4
-
Component/s: Performance, Querying
-
Environment:Linux ip-10-0-0-15 3.11.0-12-generic #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Some queries using $regex operator (e.g. "starts with") are slower in 2.6 than in 2.4. This has been noticeable on the mongo-perf suite regex test.
$explain suggests the number of scanned objects for all the query plans in 2.6 is double than in 2.4.
> for (var i=0; i < 1000;++i) { db.goo.insert({"_id":i.toString()}); } Insert WriteResult({ "ok" : 1, "n" : 1 }) > db.goo.find( { "_id": { $regex: "^1" }}).explain()
$explain output for 2.4.8
{
"cursor" : "BtreeCursor _id_ multi",
"isMultiKey" : false,
"n" : 111,
"nscannedObjects" : 111,
"nscanned" : 112,
"nscannedObjectsAllPlans" : 111,
"nscannedAllPlans" : 112,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 0,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"_id" : [
[
"1",
"2"
],
[
/^1/,
/^1/
]
]
},
"server" : "ip-10-0-0-15:27017"
}
$explain output for trunk (hash 5432e4836aec87fe9b53efe19d3bfff90ef0f6ef)
{
"cursor" : "BtreeCursor _id_",
"isMultiKey" : false,
"n" : 111,
"nscannedObjects" : 111,
"nscanned" : 112,
"nscannedObjectsAllPlans" : 210,
"nscannedAllPlans" : 211,
"scanAndOrder" : false,
"indexOnly" : false,
"nYields" : 1,
"nChunkSkips" : 0,
"millis" : 0,
"indexBounds" : {
"_id" : [
[
"1",
"2"
],
[
/^1/,
/^1/
]
]
},
"server" : "ip-10-0-0-15:27017"
}
- related to
-
SERVER-12952 Regex query performance regression in v2.6.0-rc0
-
- Closed
-