mysql - Why is an index not used on a LIKE query with wildcards? -


although title column added index using following query:

alter table recipe add index title_idx (title) 

mysql doesn't use index query:

select * recipe title '%cake%'; 

i used explain keyword , key field null.

how solve it? have improve query.

you need full-text index match partially. consider normal index phone book: it's great finding people last name first name, "smith, john", useless finding people "ith" in name, you'll have go through entry entry manually matching.

any query says like '%x%' automatically table scan. not scale non-trivial sized tables.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -