From the course: SQL Server 2008 Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Viewing execution plans

Viewing execution plans - SQL Server Tutorial

From the course: SQL Server 2008 Essential Training

Start my 1-month free trial

Viewing execution plans

After you've written a few more complex SQL statements where you're using joins and sub-queries, you'll probably end up wondering, well which one is better performance-wise? Is one objectively faster or slower than the other? And of course it depends on how you are doing the join and how you are doing the sub-query, but there is a way to find out. So I'm looking right now here at the example I did in the previous module, which is selecting the company with the most expensive order, one way doing it using a JOIN, Action Bicycle Specialists, and one way doing a sub-query. Same data, same result. But what if we want to know which one is faster? Well there are quite a few ways of doing it to get fairly detailed. You can get into what's called the SQL Server Profiler, but we don't need to go that heavy. What I'm going to do is select the two blocks that I want to do. This is now considered our batch, but formally, the entire file is because there is nothing else in the file. I'm going to…

Contents