Here we go: http://pastebin.com/m2439985d
replace $company_ids by list of ids from 'companies' replace $neg_company_ids by -1 * $company_ids replace $location_ids by list of location ids from 'locations' replace $all_company_ids by list of ids from 'all_companies' The reason why I'm doing $neg_company_ids is because I want to differentiate between ids from 'companies' and from ids 'all_companies'. So I noticed that when I replace the in statements by ors, it is actually faster. Thank you so much. 2008/11/10 Ananda Kumar <[EMAIL PROTECTED]>: > can u please show me the explain plan for this sql and also the table > structure > > explain select statement > > desc table_name > > > On 11/10/08, Alex K <[EMAIL PROTECTED]> wrote: >> >> Hi Ananda, >> >> Indexes are present. I'm passing no more 10 values. >> >> Alex >> >> 2008/11/10 Ananda Kumar <[EMAIL PROTECTED]>: >> > it should not cause any issues, unless your passing too many values in >> "id >> > in(1,2,...n). >> > Are the indexes present. >> > >> > >> > On 11/10/08, Alex K <[EMAIL PROTECTED]> wrote: >> >> >> >> Hello, >> >> >> >> It seems to me that the statement "id in (id1, id2 ... idn)" is much >> >> slower than "id=id1 or id=id2 ... or id=idn" or I am doing something >> >> wrong? >> >> >> >> Thank you, >> >> >> >> Alex >> >> >> >> -- >> >> MySQL General Mailing List >> >> For list archives: http://lists.mysql.com/mysql >> >> To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] >> >> >> >> >> > >> > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]