we found an slow log, it takes 271 seconds, after check, we found that the "nscanned:107090777" is vary large. we expect that the query is an prefix search, should use index, and match only several documents.
2015-09-14T10:57:27.819+0800 I QUERY [conn17228] query fakedb.fakecoll query: { $query: { _id: { $regex: "^fake\|other_query_string" } }, $orderby: { _id: 1 } } planSummary: IXSCAN { _id: 1 } ntoreturn:200 ntoskip:0 nscanned:107090777 nscannedObjects:0 ke
yUpdates:0 writeConflicts:0 numYields:836649 nreturned:0 reslen:20 locks:{ Global: { acquireCount: { r: 1673300 }, acquireWaitCount: { r: 99240 }, timeAcquiringMicros: { r: 39751354
} }, Database: { acquireCount: { r: 836650 } }, Collection: { acquireCount: { r: 836650 } } } 271897ms
- is duplicated by
-
SERVER-29883 "|" in query string occur into a full index scan, slow query
- Closed
- is related to
-
SERVER-15235 Regex query returns incorrect results when index is present
- Closed
- related to
-
SERVER-26536 Regex containing an escaped | pipe symbol are not handled correctly
- Closed
-
SERVER-16622 RegEx query predicates using the | (vertical bar) character cannot use tight index bounds
- Backlog