MySQL Forums
Forum List  »  Optimizer & Parser

Re: Problem using LIKE with FORCE INDEX...
Posted by: Faury Rodriguez
Date: February 04, 2008 05:08PM

It's because you have the wildcard (%) at the beginning of the search string.
If you were to replace the string to be 'ill%' it would use the index.

To use the index, you need to provide at least one of the leftmost letters, because without it, the optimizer doesn't know where to start looking in the index so it has to do a full scan to find what you are looking for.

Quote from: http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html
"MySQL cannot use an index if the columns do not form a leftmost prefix of the index."

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Problem using LIKE with FORCE INDEX...
4252
February 04, 2008 05:08PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.