Reading execution plans successfully

Slides:



Advertisements
Similar presentations
Denny Cherry Manager of Information Systems MVP, MCSA, MCDBA, MCTS, MCITP.
Advertisements

Module 7 Reading SQL Server® 2008 R2 Execution Plans.
Ashwani Roy Understanding Graphical Execution Plans Level 200.
Query Optimizer Execution Plan Cost Model Joe Chang
Analysing Indexes SQLBits 6 th October 2007 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007.
Azure SQL DW – Elastic Data Analytics in the cloud Josh Sivey | Microsoft TSP #492 | Phoenix.
Eugene Meidinger Execution Plans
Dave LinkedIn
How to kill SQL Server Performance Håkan Winther.
SQL Server Statistics DEMO SQL Server Statistics SREENI JULAKANTI,MCTS.MCITP,MCP. SQL SERVER Database Administration.
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Execution Plans Detail From Zero to Hero İsmail Adar.
SQL Server Statistics DEMO SQL Server Statistics SREENI JULAKANTI,MCTS.MCITP SQL SERVER Database Administration.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
SQL Server Statistics and its relationship with Query Optimizer
Automated Enterprise-wide SQL Server Auditing
Execution Planning for Success
Parameter Sniffing in SQL Server Stored Procedures
Query Tuning without Production Data
Query Tuning without Production Data
Please Support Our Sponsors
Reading Execution Plans Successfully
Blazing-Fast Performance:
Introduction to Execution Plans
The Ins and Outs of Indexes
Marcos Freccia Stop everything! Top T-SQL tricks to a developer
The Key to the Database Engine
Please support our sponsors
Intro to Machine Learning
Cardinality Estimator 2014/2016
Statistics What are the chances
Query Optimization Techniques
SQL Server Mythconceptions And Mythteries
Dave LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave LinkedIn.
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Execution Plans Demystified
Plan cache performance tuning
Statistics: What are they and How do I use them
Hidden gems of SQL Server 2016
SQL Server 2016 Execution Plan Analysis Liviu Ieran
Reading Execution Plans Successfully
Tracking Index Usage Like a Pro
The Mac DBA, using Docker and SQL Operations Studio
SQL Server Query Plans Journeyman and Beyond
The 5 Hidden Performance Gems
SQL Server Mythconceptions And Mythteries
Transact SQL Performance Tips
Hidden Gems of SQL Server 2016
Introduction to reading execution plans
Designing SSIS Packages for Performance
Dave Bland LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave Bland LinkedIn
Query Processing CSD305 Advanced Databases.
Introduction to Execution Plans
Score a (row) goal and beat a query optimizer
SSIS Project Deployment: The T-SQL Way
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 Five Mistakes You are Probably Making with SQL Server
Reading execution plans successfully
Introduction to Execution Plans
All about Indexes Gail Shaw.
The Ins and Outs of Indexes
SSDT, Docker, and (Azure) DevOps
Creating a Marketing Dashboard with Power BI & Dax
DAX: Functions and Context That’s What It’s All About!
An Introduction to Partitioning
Presentation transcript:

Reading execution plans successfully Arthur Daniels Reading execution plans successfully

October 30th Through November 3rd Join the brightest data professionals focused on the Microsoft Data Platform! October 30th Through November 3rd Pre-Conference Sessions – Monday/Tuesday Conference – Wedneday through Friday

SQLSaturday #682 – After Party 4th Floor of Mall of America at 6:30 PM Sponsored By:

Thank you Sponsors! Platinum Sponsor: Gold Sponsors:

DBA-Art.com Twitter: @ArthurDanSQL Presentation slides + demos Step-by-step instructions for setting up a test server at home: http://www.dba-art.com/setup-local-sql-server/

DBA-Art.com Intro 3 years working with SQL Server Presented at SQL Sat Iowa City “I don’t care how long my query takes as long as it returns results”

Overview What makes up an execution plan? DBA-Art.com Overview What makes up an execution plan? What do the operators inside the execution plan mean? What you can infer from your plan

My test environment SQL Server 2014 - Developer AdventureWorks 2014 DBA-Art.com My test environment SQL Server 2014 - Developer AdventureWorks 2014

Your environment matters DBA-Art.com Your environment matters Hardware SQL Settings Min Max Memory, Cost Threshold for Parallelism SQL version

Graphical Execution Plan DBA-Art.com Graphical Execution Plan What’s that?

Other execution plan features DBA-Art.com Other execution plan features Flow and size of line

DBA-Art.com Where and what are they? Graphical Execution Plans are stored as XML SQL Server Management Studio (SSMS) SQL Server Plan Cache Live Query Stats Query Store?

DBA-Art.com The Plan Cache sys.dm_exec_cached_plans (2008) Plan cache contains estimates Emptied when server restarts

Plan cache demo To-do: Build plan cache Find our specific plan DBA-Art.com Plan cache demo To-do: Build plan cache Find our specific plan Look at operator View actual plan’s rows vs estimated.

Graphical Execution Plan DBA-Art.com Graphical Execution Plan Plan Operators Index Seek Index Scan Key Lookup

Where do the estimates come from? DBA-Art.com Where do the estimates come from? SQL Server automatically generates statistics One statistic per index One statistic per column once a query searches by that column Search as in Where clause, JOINs

DBA-Art.com Statistics Demo Open Statistics on IX_TransactionHistoryArchive_ProductID

Statistics General Used for execution plan estimates DBA-Art.com Statistics General Used for execution plan estimates Automatically generated One for each index One for each column* Statistics contain header, density vector and histogram

Reading deeper Parallelism as operators DBA-Art.com Reading deeper Parallelism as operators Gather Streams Distribute Streams Repartition Streams

Comparing a parallel query to serial query DBA-Art.com Comparing a parallel query to serial query Demo Set Cost Threshold for Parallelism to 1 for this demo

Compute Scalar Operator DBA-Art.com Compute Scalar Operator Used for mathematical expressions Referred to as “Expr”

DBA-Art.com Compute Scalar Demo Demo here

DBA-Art.com Implicit Conversion Why? In actual and estimated

Reading Implicit Conversions DBA-Art.com Reading Implicit Conversions Demo

DBA-Art.com Missing Index Hints Execution plan will contain index suggestions Only the first missing index is shown

DBA-Art.com Missing Indexes Demo

Tools inside SQL Server 2016 Query Store Live Query Statistics

Conclusions

Wrap-Up How SQL estimates cost Operators: Index Scan, Index Seek DBA-Art.com Wrap-Up How SQL estimates cost Operators: Index Scan, Index Seek Parallelism Compute Scalar Implicit Conversions Missing Indexes

Finally, what you can infer DBA-Art.com Finally, what you can infer Look at size of lines between operators Discover what operators are doing Search your plan cache for hidden problems

DBA-Art.com Questions? You can also contact me on Twitter, @ArthurDanSQL or my website, www.DBA-Art.com

DBA-Art.com Useful links Finding Implicit Conversions in your Plan Cache Free graphical plan explorer: https://www.sentryone.com/plan-explorer/