-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.0.0
-
Component/s: Querying
-
Query Optimization
-
(copied to CRM)
-
None
-
None
-
None
-
None
-
None
-
None
-
None
This is a special case of the more general SERVER-16622. That ticket requests general support for using an index with a regular expression query with the OR operator. In this case, an index is also not used when the regular expression query contains a literal '|' which is escaped through use of the \Q ... \E escape mechanism:
db.collection.find({_id: {$regex: /^\Qfoo|bar\E/}})
Prior to the fix for SERVER-15235, (i.e., 2.6) this query would use an index; after this fix (3.0 and later), it does not.
Since this query does not use an OR operator, it would be good if it was not subject to the limitations imposed by the fix for SERVER-15235.
- related to
-
SERVER-109957 PCRE2: positive lookahead slows quadratically for certain lengths
-
- Open
-