regexp_like using wildcard prefix/suffix without anchors is unoptimized
Open
enhancement
- Dominant language
- Java
- Stars
- 6.1k
- Forks
- 1.5k
- Avg merge
- 2d 55m
- Merged PRs (30d)
- 182
Description
Take the query, `REGEXP_LIKE(direct_tags, '^.*"key":[^\]]*"value".*$'))` which searches for some array element = "value" in array "key". This query, and the minimized syntax `REGEXP_LIKE(direct_tags, '"key":[^\]]*"value"'))` are both performant.
But when the anchors are dropped like so, `REGEXP_LIKE(direct_tags, '.*"key":[^\]]*"value".*'))`, the query times out on very small numbers of documents.
As a user it's difficult to tell why some regexp patterns are so slow. I think this is a regexp library 'bug', but since prefixing/suffixing a search string with `.*` is a common user behavior it seems to make sense to optimize this.
Contributor guide
Assessment
This issue has not been assessed yet.