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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -