July 17, 2005 at 4:33 pm
Jesper, query would still be the same regardless which query run first.
Remi, the issue is about joins vs subqueries. It is about utilizing "the best" query in JOINs and compare that against "the best" query using subqueries. So using NOT IN is not appropriate here.
Regards,
July 18, 2005 at 12:24 am
I thought that maybe the performance difference had something to do with caching. Now I have executed each query 1000 times, and the "not exists" query is definitely faster - about 2 seconds vs. 3 seconds for 1000 executions.
July 18, 2005 at 9:25 am
I think that is a very good and underestimated point sara.
Personally I veer heavily towards the subquery route. My general rule of thumb, unless encountering severe performance issues is that If the only reason I'm refering to the table is criteria related, then it's a sub-query. I only Join the table when columns from that table are required in the result set.
Viewing 3 posts - 16 through 17 (of 17 total)
You must be logged in to reply to this topic. Login to reply