Re: query running very slow, need a little help

2012-12-04 Thread Akshay Suryavanshi
Hi, A subquery with IN clause is not a good idea. If you want to tune this query, try adding indexes on the tables accessed in the inner query credits. A composite index on (success,promoter_id) would be sufficient, then the optimizer will use this index for the where clause and as a covering

query running very slow, need a little help

2012-12-04 Thread Paul Nowosielski
Hi, I'm running this query: mysql SELECT email FROM promoters where id NOT IN (SELECT promoter_id FROM credits WHERE success = 1 ) and active = 1; Empty set (31.89 sec) its returning an empty set and take over 30 seconds to return. mysql describe promoters;