List:General Discussion« Previous MessageNext Message »
From:Steve Edberg Date:April 26 2001 5:17pm
Subject:Re: Database Index Question
View as plain text  
At 9:31 AM -0700 4/26/01, Shane Gentry wrote:
>  Does it help to put an Index on a column when you
>  use a LIKE query.
>
>  ex. SELECT * FROM users WHERE name LIKE '%tom%'
>
>  Thanks in Advance!
>

In this case, It won't help, since you have a wildcard at the 
beginning of your pattern. If you used ...LIKE 'tom%' instead, I 
believe MySQL WOULD use an index on 'name.'

-steve

-- 
+---------- KDVS 90.3fm Annual Fundraiser : 16 - 22 April 2001 ----------+
| Steve Edberg                           University of California, Davis |
| sbedberg@stripped                               Computer Consultant |
| http://aesric.ucdavis.edu/                  http://pgfsun.ucdavis.edu/ |
+----------------------------- www.kdvs.org -----------------------------+
Thread
Database Index QuestionShane Gentry26 Apr
  • Re: Database Index QuestionSteve Edberg26 Apr