It’s Friday, time to look back at the most popular RealSQLGuy posts of the week. Because it’s Friday and you’re not doing any real work anyway.
Posts That Were Popular This Week
- Which One’s Better?
- Don’t Get Slimed By Bad Parameter Sniffing
- Cheating DBCC To Fix Index Corruption
- Building (for FREE) a Virtual Server for SQL Demos
- Automated Permissions Auditing With Powershell and T-SQL: Part 1
- Do You Need A Log Recovery Tool?
- Using A Non-correlated Subquery To Avoid DISTINCT
- What Are Your Servers Doing While You’re Sleeping?
- Automated Permissions Auditing With Powershell and T-SQL: Part 5
- Automated Permissions Auditing With Powershell and T-SQL: Part 6
Comments That Were Posted This Week
- DoctorOwl on Which One’s Better?:
I couldn’t help but notice you didn’t try any of the EXISTS clauses with TOP 1. So out of pedantism I re-ran all the original tests 4 times each and their TOP 1 counterparts (the execution plans and IO appeared to be the same):Elapsed time: 2808 ms
Elapsed time: 2771 ms
Elapsed time: 2805 ms
Elapsed time: 2768 ms
All originals average at 2778 ms
vs
Elapsed time: 2798 ms
Elapsed time: 2741 ms
Elapsed time: 2727 ms
Elapsed time: 2782 ms
All TOP 1 average at 2762 ms
I think it’s fair to say that it’s not significant in practice, but also that it’s hard to tell if there’s any actual significant difference between them. I guess if we run that million a million more times…
- realsqlguy on Which One’s Better?:
Since EXISTS stops on the first match it finds, it is, in effect, doing a TOP 1. I would expect there to be no difference between them, but as you say, it’s hard to tell.
This Week In History
None, the past holds no lessons this week
That’s it for this week. Get back to work!