Re: How many colums should a index contain?

2006-11-04 Thread John . H
Thanks all. And after these two days I have understood how to create a index to help my query to run more faster,also I found that use 'explain' before a query just get a result only provide reference cause it doesn't show the really result how the query is run,for example the 'key' item. That is

Will a subquery use a index?

2006-11-02 Thread John . H
I found that when I use a query as a subquery it will not use the right index at all??

How many colums should a index contain?

2006-11-02 Thread John . H
I have two tables and I must do : select `id`,`bid`,`title`,`link`,`bname` from table1 where `bid` in ( ...this is a subquery in table2 ) should I create a index (`id`,`bid`,`title`,`link`,`bname`) so that my query will take less time or should a index contain so many colums?