troubleshooting Question

SQL query performance

Avatar of phman1275
phman1275 asked on
Microsoft SQL Server
5 Comments1 Solution53 ViewsLast Modified:
I have 3 different but  equivalent queries. Do you mind tell me how to check and see which one has the best execution performance?

-- 1
select a from t1
where mod(a,5) = 0 and b in
( select b from t2
     where c in ( SELECT c FROM t3 where mod(d,5) = 0 ));
-- 2
select t1.a from t1, t2, t3 where
t1.b = t2.b and t2.c = t3.c and mod(t1.a,5) = 0 and mod(t3.d,5) = 0;

-- 3
select t1.a from (t1 join t2 on t1.b = t2.b ) join t3 on t2.c = t3.c
where mod(t1.a,5) = 0 and mod(t3.d,5) = 0;
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros