-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.8.0-rc1
-
Component/s: Querying
-
None
-
Query Optimization
The mongodb regex parser cannot create accurate bounds to allow indexed lookups when the regex includes the "|" character. This was allowed previously, but could lead to incorrect results.
Original Description
I've got a database with 14 mio rows representing an imaginary "file system". There are (amongst others) the fields "type" (only "folder" or "file"), "folder" and "filename".
I now try this:
{ type:'folder', folder:/^example1/ } Very fast. No results - as expected. In fact, no rows even start with "example". I now try this: { type:'folder', folder:/^example2/ }
Very fast, too. No results again - as expected.
Now, I try this:
{ type:'folder', folder:/^example(1|2)/ }
This query never returns. The whole database becomes horribly slow to the point of being unusable. I cannot even run any other queries. This used to work on 2.4.x. Why?
- is duplicated by
-
SERVER-22939 A regular expression with an escaped pipe '|' character is treated as non-simple
- Closed
-
SERVER-19679 Presence of pipe '|' is search causes all keys to be examined
- Closed
-
SERVER-22890 3.2.3 performance regression
- Closed
-
SERVER-29883 "|" in query string occur into a full index scan, slow query
- Closed
- is related to
-
SERVER-20432 $regex prefix search with escaped "|" should use tighter index bounds
- Closed
- related to
-
SERVER-15235 Regex query returns incorrect results when index is present
- Closed
-
SERVER-22872 Order by is not working in 3.2.3
- Closed
-
SERVER-26536 Regex containing an escaped | pipe symbol are not handled correctly
- Closed
-
SERVER-23202 Query planner does not trim certain bounds-generating inequality predicates from expression tree
- Closed