From the course: SQL Server 2014 Essential Training

Unlock the full course today

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

Exploring execution plans

Exploring execution plans - SQL Server Tutorial

From the course: SQL Server 2014 Essential Training

Start my 1-month free trial

Exploring execution plans

- In this section, we're going to talk about execution plans. When you submit a query to Microsoft SQL Server 2014, the machine comes up with a series of steps on how it's going to perform the task. This series of steps is called an execution plan, and we can see the execution plan, and by analyzing it, we sometimes find places where we could improve the execution, often by creating indexes. So I've staged some code we're going to work with. It's in your exercise files. If you wanna take all of that and copy and paste it into a new query in Management Studio. It's a fairly straightforward "SELECT" statement. We're gonna select one field, called "CarrierTrackingNumber", from the "Sales.SalesOrderDetail" table. We're only gonna return rows "WHERE CarrierTrackingNumber IS NOT NULL". and we're going to "ORDER BY CarrierTrackingNumber". If we execute that, we see that approximately 60,000 rows were returned. So that means the machine had to sort 60,000 individual values. And on a powerful…

Contents