SQL Homework – January 2018 – Inspect an Execution Plan
6January 3, 2018 by Kenneth Fisher
It’s a new year and yet education never ends. So this month let’s take a look at an important part of performance tuning. The Execution Plan. When a query is run, the optimizer goes through and selects what it feels will be the good enough plan to plan that query. Note: that’s good enough not best. The optimizer is designed to get that plan quickly rather than spending a lot of time trying to find a better plan.
If you want to learn about execution plans in detail I highly recommend getting Grant Fritchey’s (b/t) excellent book SQL Server Execution Plans. In the mean time here is your homework.
- View a graphical execution plan (10 pts)
- Is it the Estimated or Actual plan? What’s the difference? (10 pts)
- View the properties of a given operator (any one will do). If you are looking at an actual plan, how far off are your estimates? Any idea where those estimates come from? (10 pts)
- View the properties of one of the arrows between two operators (any one will do). What does this represent? How can this information be useful? (5 pts)
- Read the plan from left to right, then from right to left. Don’t worry if you don’t understand what each operator does yet. Which ones do you understand? Based on your query can you figure out what the plan is doing in general? (10 pts)
- View the XML execution plan (20 pts)
- Is it the Estimated or Actual plan? What’s the difference? (10 pts)
- Can you find the properties of the same operator you looked at in the graphical plan? (15 pts)
- Save the plan to a file for future consideration. (5 pts)
- Close all copies of the plan and open the file that you have saved. (5 pts)
The dream of the 90s is alive in that Clip Art.
I have you know I worked very hard to find something that had just that feel to it :p
What? No plan comparisons?
The basics man! The basics! Although to be quite honest I didn’t think of that, it’s still probably a bit behind the level I’m aiming at with most of these posts.
Ah, to re-live the joy of opening the plan xml and seeing there’s more than 1 index recommendation!
No kidding! It was a bit of a shocker when I realized it the first time.