-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.6.0-rc0
-
Component/s: Querying
-
ALL
-
The following regex query takes roughly 8x longer in v2.6.0-rc0 vs. v2.4.9:
db.QA401.find({ _id: /Big(ww)i/ }).sort({a:1})
The test collection has 920 documents (see attached) with the following indices:
db.QA401.ensureIndex({a:-1}) db.QA401.ensureIndex({'a.a':-1}) db.QA401.ensureIndex({'a.a.a':-1})
v2.6.0-rc0:
> db.QA401.find({ _id: /Big(ww)i/ }).sort({a:1}).explain(); { "cursor" : "BtreeCursor _id_", "isMultiKey" : false, "n" : 0, "nscannedObjects" : 0, "nscanned" : 1, "nscannedObjectsAllPlans" : 1, "nscannedAllPlans" : 2, "scanAndOrder" : true, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 0, "indexBounds" : { "_id" : [ [ "", { } ], [ /Big(ww)i/, /Big(ww)i/ ] ] }, "server" : "zzyzx:27017", "filterSet" : false }
v2.4.9:
> db.QA401.find({ _id: /Big(ww)i/ }).sort({a:1}).explain(); { "cursor" : "BtreeCursor _id_ multi", "isMultiKey" : false, "n" : 0, "nscannedObjects" : 0, "nscanned" : 1, "nscannedObjectsAllPlans" : 0, "nscannedAllPlans" : 3, "scanAndOrder" : true, "indexOnly" : false, "nYields" : 0, "nChunkSkips" : 0, "millis" : 0, "indexBounds" : { "_id" : [ [ "", { } ], [ /Big(ww)i/, /Big(ww)i/ ] ] }, "server" : "zzyzx:27018" }
The query times are sub-millisecond; here is the output from QA-401:
{ "_id" : ObjectId("530f6bad7e6c53525919dfb6"), "deltaRatio" : "8.40", "deltaUs" : 741, "v249Avg" : "100.17", "v249Results" : [ 100, 102, 101, 99, 100, 99 ], "rc0Avg" : "841.17", "rc0Results" : [ 870, 882, 839, 817, 815, 824 ], "testId" : "GeneratedTests::GeneratedQuery750[Descending]", "qry" : "{ query: { _id: //Big(ww)i// }, orderby: { a: 1 } }", "proj" : "{ NONE: 1 }", "idx" : "Descending", "rc0Count" : 0, "v249Count" : 0, "countsMatch" : true }
I'm having a tough time distilling this down to something which can be reproduced in the shell (with measurable results).
- is duplicated by
-
SERVER-13139 Performance regression with smaller $in queries
- Closed
- is related to
-
SERVER-12287 Query containing $regex operator: performance regression
- Closed