Hi ! the table has about 12.000 rows total but the query should return a max of about 100. mysql should split the query into two queries and merge the results. may be this could be done by joining the same table two times and query each table only for one of the OR expression. i'll try but for future versions of mysql, this should be internally done i think... ;)
Corin Check it out => http://www.find-mich.net Thursday, October 17, 2002, 4:07:01 PM, you wrote: EE> Corin, EE> Thursday, October 17, 2002, 3:09:08 PM, you wrote: CL>> i have the following problem. I have a table wherey to_id CL>> and owner_id are of type unsigned int not null and both CL>> are normal indexes. Unluckily a query like: CL>> ------ CL>> EXPLAIN SELECT * FROM `telegramme` WHERE to_id = 3157 or owner_id = 3157 CL>> ------ CL>> returns very bad results: CL>> ------ CL>> table type possible_keys key key_len ref rows Extra CL>> telegramme ALL to_id,owner_id NULL NULL NULL 11488 where used CL>> ------ CL>> how could this be optimized or is this a bug of mysql, because the CL>> indexes exist but are not used (even if specified with use index(..)) ?! EE> How many rows there are in table `telegramme`? When MySQL needs to access to more EE> that 30% records in the table, it doesn't use an index: EE> http://www.mysql.com/doc/en/MySQL_indexes.html --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php