Reading Execution Plans Successfully

Slides:



Advertisements
Similar presentations
SQL Server performance tuning basics
Advertisements

SQL Server Query Optimizer Cost Formulas Joe Chang
Easy HTML DB. Michael Cunningham Developer/Database Administrator.
How a little code can help with support.. Chris Barba – Developer at Cimarex Energy Blog:
Denny Cherry Manager of Information Systems MVP, MCSA, MCDBA, MCTS, MCITP.
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
Ashwani Roy Understanding Graphical Execution Plans Level 200.
Microsoft AREC TAM Internship SQL Server Performance Tuning(I) Haijun Yang AREC SQL Support Team Feb, SQL Server 2000.
Query Optimizer Execution Plan Cost Model Joe Chang
Analysing Indexes SQLBits 6 th October 2007 © Colin Leversuch-Roberts Kelem Consulting Limited September 2007.
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
Execution Planning for Success
SQL Server Statistics 101 Travis Whitley Senior Consultant, Oakwood Systems whitleysql.wordpress.com.
UFC #1433 In-Memory tables 2014 vs 2016
Efficiently Searching Schema in SQL Server
Parameter Sniffing in SQL Server Stored Procedures
Reading execution plans successfully
Please Support Our Sponsors
Reading Execution Plans Successfully
Blazing-Fast Performance:
Introduction to Execution Plans
Marcos Freccia Stop everything! Top T-SQL tricks to a developer
The Key to the Database Engine
Cardinality Estimator 2014/2016
Query Optimization Statistics: The Driving Force Behind Good Performance G. Vern Rabe -
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
SQL Server 2016 Execution Plan Analysis Liviu Ieran
Tracking Index Usage Like a Pro
SQL Server Query Plans Journeyman and Beyond
SQL Server Mythconceptions And Mythteries
Introduction to reading execution plans
SQL Server Query Optimizer Cost Formulas
Dave Bland LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave Bland LinkedIn
Query Processing CSD305 Advanced Databases.
Please Support our Sponsors
Introduction to Execution Plans
Execution plans Eugene
The Ins and Outs of Indexes
Diving into Query Execution Plans
Query Profiling Options in SQL Server
Introduction to Execution Plans
Query Optimization Techniques
The Five Mistakes You are Probably Making with SQL Server
SQL Server Execution Plan Primer
Reading execution plans successfully
T-SQL Basics: Coding for performance
Introduction to 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
The Ins and Outs of Indexes
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:

Reading Execution Plans Successfully Arthur Daniels Reading Execution Plans Successfully

Arthur Daniels Twitter: ArthurDanSQL www.DBA-Art.com Database Administrator SAP Fieldglass Started presenting last year “I don’t care how long my query takes as long as it returns results”

Overview Structure of the plan First operators DBA-Art.com Overview Structure of the plan First operators Warnings and suggestions Manipulating an execution plan

DBA-Art.com Disclaimer: SQL Server 2014 and above AdventureWorks 2014

Your environment matters DBA-Art.com Your environment matters Hardware SQL Settings Min and max memory Cost threshold for parallelism Max DOP SQL version

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

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

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

DBA-Art.com Where and what are they? Graphical Execution Plans are stored as XML SQL Server Management Studio (SSMS) Live Query Stats SQL Server Plan Cache 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 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.

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

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

Manipulating an execution plan DBA-Art.com Manipulating an execution plan 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

Wrap-Up Structure Operators: Seek, Scan, Lookup Statistics and Indexes DBA-Art.com Wrap-Up Structure Operators: Seek, Scan, Lookup Statistics and 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 Pay attention to warnings

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

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 Useful links Finding Implicit Conversions in your Plan Cache Free graphical plan explorer: https://www.sentryone.com/plan-explorer/