Analyzing Execution Plans

Slides:



Advertisements
Similar presentations
EXECUTION PLANS By Nimesh Shah, Amit Bhawnani. Outline  What is execution plan  How are execution plans created  How to get an execution plan  Graphical.
Advertisements

Sponsored by: Professional Association for SQL Server Bad plan! Sit! Gail Shaw.
SQL Server Query Optimizer Cost Formulas Joe Chang
The query processor does what the query plan tells it to do A “good” query plan is essential for a well- performing.
Denny Cherry Manager of Information Systems MVP, MCSA, MCDBA, MCTS, MCITP.
Understanding SSIS Control Flows Bret Stateham Training Manager Vortex Learning Solutions blogs.netconnex.com.
“Participant-Centered Training” Bob Pike Annual Conference September 12-14, 2012 Minneapolis, MN.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
1 Session 3: Flow Control & Functions iNET Academy Open Source Web Programming.
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
Improving Database Performance Derrick Rapley
Programming in R SQL in R. Running SQL in R In this session I will show you how to: Run basic SQL commands within R.
Query Optimizer Execution Plan Cost Model Joe Chang
How to Use Parameters Like a Pro …and Boost Performance Guy Glantser, CEO, Madeira.
Ch 2. Creating and Configuring Databases. SQL Server Management Studio (SSMS) Graphical way to create / manage SQL Server Combines features from Query.
Part-time Jobs. What’s the difference between part-time jobs in the West and China?
Eugene Meidinger Execution Plans
Work. Think of and write down at least five jobs that you might like to have.
Dave LinkedIn
How to kill SQL Server Performance Håkan Winther.
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Execution Plans Detail From Zero to Hero İsmail Adar.
Bret Stateham Owner, Net Connex blogs.netconnex.com
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
High Performance Functions SQLBits VI. Going backwards is faster than going forwards.
Session Name Pelin ATICI SQL Premier Field Engineer.
Part-time Jobs. What’s the difference between part-time jobs and temporary jobs?
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
SQL Server Statistics and its relationship with Query Optimizer
Chapter 3: Decisions and Loops
Query Tuning without Production Data
UFC #1433 In-Memory tables 2014 vs 2016
Query Tuning without Production Data
Working with Very Large Tables Like a Pro in SQL Server 2014
Decoding the Cardinality Estimator to Speed Up Queries
The Key to the Database Engine
Now where does THAT estimate come from?
Physical Join Operators
TSQL Coding Techniques
Statistics What are the chances
Top Tips for Better TSQL Stored Procedures
Statistics: What are they and How do I use them
Mean.
TEMPDB – INTERNALS AND USAGE
Hugo Kornelis Now where does THAT estimate come from? The nuts and bolts of cardinality estimation.
Tally Ho! -- Explore the Varied Uses of Tally Tables
SQL Server Query Plans Journeyman and Beyond
How to Use Parameters Like a Pro
Hidden Gems of SQL Server 2016
Introduction to reading execution plans
In the name of the resources - aggregating data
SQL Server Query Optimizer Cost Formulas
Dave Bland LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave Bland LinkedIn
Introduction to Execution Plans
Execution plans Eugene
Diving into Query Execution Plans
Query Profiling Options in SQL Server
SQL Server Query Design and Optimization Recommendations
Introduction to Execution Plans
The Complete Guide to Temporary Tables and Table Variables
Reading execution plans successfully
Performance Tuning for SQL Developers through Execution Plans
Performance Tuning for SQL Developers through Execution Plans
The Complete Guide to Temporary Tables and Table Variables
Working with Very Large Tables Like a Pro in SQL Server 2017
Performance Tuning for SQL Developers through Execution Plans
Performance Tuning for SQL Developers through Execution Plans
Performance Tuning for SQL Developers through Execution Plans
Performance Tuning for SQL Developers through Execution Plans
Presentation transcript:

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

A Few Words about Me… Name: Guy Glantser Email Address: guy@madeiradata.com Twitter: @guy_glantser Blog: www.madeiradata.com/author/guy Podcast: www.sqlserverradio.co.il Image courtesy of Mister GC / FreeDigitalPhotos.net

A Few Words about Me… Name: Guy Glantser Email Address: guy@madeiradata.com Twitter: @guy_glantser Blog: www.madeiradata.com/author/guy Podcast: www.sqlserverradio.co.il Image courtesy of Mister GC / FreeDigitalPhotos.net

Agenda Image courtesy of Stuart Miles / FreeDigitalPhotos.net

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

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

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

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

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

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

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

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

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

Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net

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