Presentation is loading. Please wait.

Presentation is loading. Please wait.

Analyzing Execution Plans

Similar presentations


Presentation on theme: "Analyzing Execution Plans"— Presentation transcript:

1 Analyzing Execution Plans
Like a Pro Guy Glantser Image courtesy of Chris Sharp / FreeDigitalPhotos.net

2 A Few Words about Me… Name: Guy Glantser
Address: Twitter: @guy_glantser Blog: Podcast: Image courtesy of Mister GC / FreeDigitalPhotos.net

3

4 A Few Words about Me… Name: Guy Glantser
Address: Twitter: @guy_glantser Blog: Podcast: Image courtesy of Mister GC / FreeDigitalPhotos.net

5 Agenda Image courtesy of Stuart Miles / FreeDigitalPhotos.net

6 Summary Compare Session Settings
Each combination of the session settings produces a different execution plan. By default, the SQL Native Client sets ARITHABORT to False, while SQL Server Management Studio sets this option to True. Image courtesy of Chris Sharp / FreeDigitalPhotos.net

7 Summary Cost is Always Estimated!
Even when you look at the actual execution plan, the cost is estimated. There is no such thing as actual cost. If there is a difference between the estimated and the actual number of rows, then don’t trust the cost. Image courtesy of Chris Sharp / FreeDigitalPhotos.net

8 Summary Compare Estimated vs. Actual Number of Rows
Most performance problems will have this as a symptom. Find the operator in which there is a big difference between the estimated and the actual number of rows, and in most cases this will lead you to the root of the problem. Image courtesy of Chris Sharp / FreeDigitalPhotos.net

9 Summary Nested Loops can be Misleading
In the inner operator of a Nested-Loops join, the estimated number of rows reflects the number of rows per iteration, while the actual number of rows reflects the total number of rows. Image courtesy of Chris Sharp / FreeDigitalPhotos.net

10 Summary Never Use Table Variables!
Table variables don’t have associated statistics, so the optimizer always assumes there is a single row in them. This leads in many cases to serious performance problems, especially when the table variable is involved in a join operation. Prefer temporary tables whenever you can. Image courtesy of Chris Sharp / FreeDigitalPhotos.net

11 Summary Read Execution Plans in Both Directions
Reading an execution plan from right to left is helpful in understanding the data flow, while reading an execution plan from left to right is helpful in understanding the runtime execution flow. Image courtesy of Chris Sharp / FreeDigitalPhotos.net

12 Summary Tooltips are Just Tooltips You can also use:
Operator properties ShowPlan XML Trace flags Debugger (only if your name is Paul White) Image courtesy of Chris Sharp / FreeDigitalPhotos.net

13 Summary Avoid Using Scalar Functions
Although they make sense in terms of modularity and reusability, they really suck in terms of performance. In many cases, it is possible to rewrite the scalar function as an inline function, thus enjoying modularity, reusability and good performance together. Image courtesy of Chris Sharp / FreeDigitalPhotos.net

14 Questions? Image courtesy of Master isolated images / FreeDigitalPhotos.net

15 Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net

16 Stay In Touch… Name: Guy Glantser Email Address: guy@madeiradata.com
Twitter: @guy_glantser Blog: Podcast: Image courtesy of Nuttapong / FreeDigitalPhotos.net


Download ppt "Analyzing Execution Plans"

Similar presentations


Ads by Google