Hey I got query: SELECT count( * ) AS count FROM triple_aaa, triple_bbb WHERE triple_aaa.id =66 OR triple_aaa.id IN ( SELECT id FROM triple_bbb WHERE high =64 ) without Second Part works very fast: SELECT count( * ) AS count FROM triple_aaa, triple_bbb WHERE triple_aaa.id =66 Difference in 6 seconds, even if the second part getting 0 results and runtime of it is almost 0 seconds: SELECT id FROM triple_bbb WHERE high =64 But together it takes 6 seconds to run it, I am thinking its not properly used of IN , can you suggest me solution ?
try this: SELECT count( * ) AS count FROM triple_aaa, triple_bbb WHERE triple_aaa.id =66 OR (triple_aaa.id=triple_bbb.in AND triple_bbb.high =64)