MySQL Forums
Forum List  »  General

Re: Using "LIKE"?
Posted by: Felix Geerinckx
Date: May 10, 2005 07:58AM

Bruce D wrote:

> I read somewhere that using "LIKE" in the select statement would cause the engine to NOT use the
> indexes.

It depends on your use of wildcards. In general:

col LIKE 'a%' -> index is used
col LIKE '%a%' -> index is not used

More characters before '%' -> better use of index.

Try it with EXPLAIN SELECT col FROM foo WHERE col LIKE ... on your table

and look at the rows column.

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
May 10, 2005 07:46AM
Re: Using "LIKE"?
May 10, 2005 07:58AM


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.