View Single Post

   
  #4 (permalink)  
Old 02-28-2008, 07:56 AM
Bill Karwin
 
Posts: n/a
Default Re: Index question...

howachen@gmail.com wrote:
> 1. i am using MyISAM, not InnoDB, so no foreign key.


Aha. Then you should create an index explicitly on b.fid.

> 2. if both indexes are added, under explain statement, i see only one
> index is used at a time. the optimizer seems will select the best index
> to use?


MySQL may use one index per table in a query. But the optimizer may
judge in some cases, that reading the index into memory is more
expensive than just reading the rows of data.

Regards,
Bill K.
Reply With Quote