0

I have query which uses like with "%search_pattern%" which is taking high CPU utilization if i hit 5-6 parallel request, my table has data around 30 Million.

Can any alternative methods or algorithm be used to optimize that?

Ex:

SELECT * FROM USER_DETAILS U WHERE U.NAME LIKE %JOHN%';

CPU Utilization is going to 700%

Matt
  • 14,906
  • 27
  • 99
  • 149
  • 1
    Possible duplicate of [Optimization of MySQL search using "like" and wildcards](http://stackoverflow.com/questions/2081998/optimization-of-mysql-search-using-like-and-wildcards) – FuzzyTree Oct 13 '15 at 10:28

1 Answers1

1

When you use LIKE '%JOHN%' mysql cant use a index and must compare each ROW with the String. The only way to use a Index is use LIKE 'JOHN%' ´. look if a index on NAME

Bernd Buffen
  • 14,525
  • 2
  • 24
  • 39