-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sql: LIKE and ILIKE with exact match strangely slow #91887
Labels
A-sql-execution
Relating to SQL execution.
C-performance
Perf of queries or internals. Solution not expected to change functional behavior.
E-quick-win
Likely to be a quick win for someone experienced.
T-sql-queries
SQL Queries Team
Comments
michae2
added
C-performance
Perf of queries or internals. Solution not expected to change functional behavior.
A-sql-execution
Relating to SQL execution.
T-sql-queries
SQL Queries Team
labels
Nov 15, 2022
I wonder if this is the same underlying problem as #89749? |
According to profiling we're not using |
michae2
added a commit
to michae2/cockroach
that referenced
this issue
Nov 15, 2022
`eval.optimizedLikeFunc` has special cases for LIKE patterns that start and end with wildcards `%` or `_` which can be evaluated without regular expressions. Add support for patterns with no wildcards at all. Fixes: cockroachdb#91887 Assists: cockroachdb#89749 Epic: None Release note (performance improvement): Performance of the `LIKE` and `ILIKE` operators using patterns without any wildcards has been improved.
craig bot
pushed a commit
that referenced
this issue
Nov 16, 2022
91895: eval: add LIKE patterns without wildcards to optimizedLikeFunc r=DrewKimball,yuzefovich a=michae2 `eval.optimizedLikeFunc` has special cases for LIKE patterns that start and end with wildcards `%` or `_` which can be evaluated without regular expressions. Add support for patterns with no wildcards at all. Fixes: #91887 Assists: #89749 Epic: None Release note (performance improvement): Performance of the `LIKE` and `ILIKE` operators using patterns without any wildcards has been improved. Co-authored-by: Michael Erickson <[email protected]>
msirek
pushed a commit
to msirek/cockroach
that referenced
this issue
Jun 30, 2023
`eval.optimizedLikeFunc` has special cases for LIKE patterns that start and end with wildcards `%` or `_` which can be evaluated without regular expressions. Add support for patterns with no wildcards at all. Fixes: cockroachdb#91887 Assists: cockroachdb#89749 Epic: None Release note (performance improvement): Performance of the `LIKE` and `ILIKE` operators using patterns without any wildcards has been improved.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-sql-execution
Relating to SQL execution.
C-performance
Perf of queries or internals. Solution not expected to change functional behavior.
E-quick-win
Likely to be a quick win for someone experienced.
T-sql-queries
SQL Queries Team
The
LIKE
andILIKE
operators are strangely very slow when using an exact match. Even slower than with the same pattern wrapped with wildcards. Here's a demonstration using some different text operators:Below is an unscientific best-of-five-runs comparison of PostgreSQL 14.6 and single-node CockroachDB v22.2.0 on the same hardware. Everything looks reasonable except for the last two cases:
=
<
||
position
trim
LIKE
with wildcardsILIKE
with wildcards~
~*
LIKE
no wildcardsILIKE
no wildcardsJira issue: CRDB-21469
The text was updated successfully, but these errors were encountered: