MySQL Forums
Forum List  »  Performance

Re: Queries slow down daily, optimizing helps -> why?
Posted by: aftab khan
Date: February 18, 2009 09:04AM

>SELECT id FROM user WHERE un like '%somebody%'
your explain shows that it's doing table scan, which is true because when % appears at the start of search text in this mysql doesn't use index. ( I don't know if you have defined index for `un` column, if you do have then kindly drop it).

What I suggest create FULLTEXT index i.e. ALTER TABLE user ADD FULLTEXT (un);


SELECT id FROM user WHERE MATCH(un) AGAINST ('sombody');

Aftab Khan

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Queries slow down daily, optimizing helps -> why?
2222
February 18, 2009 09:04AM
2086
March 18, 2009 03: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.