I am trying to figure out the most 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. I have posted the same at http://stackoverflow.com/questions/2356714/mysql-query-optimisation Regards Deepan +91 9945702482 http://www.hashcube.com http://twitter.com/codeshepherd _______________________________________________ ILUGC Mailing List: http://www.ae.iitm.ac.in/mailman/listinfo/ilugc