howachen@gmail.com wrote:
> SELECT * FROM a,b where a.id = b.fid
>
> Should we add index to both a.id and b.fid?
If a.id and b.fid are primary key and foreign key, respectively, they
already have indexes.
If not, then yes, creating indexes would be good. Do you know how to
use the EXPLAIN analyzer to tell you what indexes are being used by a
given query?
See
http://dev.mysql.com/doc/refman/5.0/en/explain.html
Regards,
Bill K.