--- On Mon, 1/3/10, Deepan Chakravarthy <codeshepherd@xxxxxxxxx> wrote:
I am trying to figure out the mostBased on my experience, observations are
optimal mysql query.
Query 1:? SELECT? cid, dl FROM? ? chal
WHERE???cid IN ( SELECT? cid
FROM? ? c_users WHERE???uid =
636587 );
Query 2:? SELECT? chal.cid AS cid, chal.dl?
AS dl FROM? ? chal,
c_users WHERE???uid = 808 AND? ?
chal.cid = c_users.cid;
cid is primary key in chal cid and uid are indexed in
c_users, cid is
not unique;
Which of the above query is better?
Explain says the following
Query 1 uses two types of index namely ALL and
index_subquery
Query 2 users two types of index namely ALL and ref
I wonder why both queries say ALL as type of index though
cid is
primary key in table chal.