MySQL Forums
Forum List  »  Newbie

select ... where ... in(select ..)
Posted by: Majdi Swais
Date: August 12, 2005 02:05AM

I'm trying to execute the following query
"select f1,f2 from table1 where f2 in (select f3 from table2 where ...)"

The inner select is very simple.
This query takes too much time to execute when table1 contains thousands of rows. If I execute "select f3 from table2 where ...", get the results (let us say 1,5,9,10) and rewrite the query as:
"select f1,f2 from table1 where f2 in (1,5,9,10)", the query will execute very fast (as expected)
Note: both f2 and f3 are integers and indexed, table1 contains 300,000 records

Any ideas
Regards

Options: ReplyQuote


Subject
Written By
Posted
select ... where ... in(select ..)
August 12, 2005 02:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.