Posted by Stefan Rybacki on 12/15/05 17:26
Anze wrote:
> Hi all!
>
> I stumbled across this query that I just can't optimize - even if I create
> all possible indexes it doesn't use them. Could someone please clue me in?
> I have no idea why MySQL doesn't use the indexes. :(
>
> The query in question is:
>
> mysql> explain select count(a0.count) from srchIds ids, srchWords a0 where
> a0.word LIKE '%abc%' and a0.id=ids.id group by ids.category;
The problem is your like clause, because you use leading % mysql isn't able to
use an index for it. To speed this up you could try to use the fulltext
functions and the fulltext index of mysql but that isn't sure to help you.
>
> Thank you!
Regards
Stefan
>
> Anze
Navigation:
[Reply to this message]
|