Performance Tuning for SQL Developers through Execution Plans

Slides:



Advertisements
Similar presentations
SQL Server performance tuning basics
Advertisements

EXECUTION PLANS By Nimesh Shah, Amit Bhawnani. Outline  What is execution plan  How are execution plans created  How to get an execution plan  Graphical.
Executing Explain Plans and Explaining Execution Plans Craig Martin 01/20/2011.
Module 7 Reading SQL Server® 2008 R2 Execution Plans.
Ashwani Roy Understanding Graphical Execution Plans Level 200.
DTS Conversion to SSIS Conversion Best Practices Mike Davis
Chapter 2: SQL – The Basics Objectives: 1.The SQL execution environment 2.SELECT statement 3.SQL Developer & SQL*Plus.
SQL Dev Tips for Small Workstations How to develop SQL on small dev workstations when prod is huge. Kevin Kline and Aaron Bertrand SQL Sentry.
Gail Shaw XpertEase DAT 305 Topics Background Information Query Hints Plan Cache Metadata Plan Guides Plan Freezing Monitoring Plan Guide Use.
Eugene Meidinger Execution Plans
Dave LinkedIn
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Execution Plans Detail From Zero to Hero İsmail Adar.
Why Should I Care About … The Plan Cache? Tuning When Stakeholders Won’t Say Where It Hurts.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
High Performance Functions SQLBits VI. Going backwards is faster than going forwards.
How to submit a support file using the Avast Support Tool?
Basic Outputs to Troubleshooting Queries.
SQL Database Management
An Introductory Look at Execution Plans
Citation format 1 The “Citation” display option is similar to the abstract display but has some extra information such as MeSH terms and substances listed.
Crash course on Better SQL Development
Execution Planning for Success
How to Fi
Introduction to Web programming
Reading execution plans successfully
Execution plans (300) Tomaž Kaštrun Spar ICS GmbH, Spar Slovenija
Reading Execution Plans Successfully
Introduction to Execution Plans
Third Party Tools for SQL Server
The Key to the Database Engine
Crash course on Better SQL Development
Query Optimization Techniques
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Execution Plans Demystified
Plan cache performance tuning
Reading Execution Plans Successfully
Using JDeveloper.
SQL Server Query Plans Journeyman and Beyond
Crash course on Better SQL Development
Crash course on Better SQL Development
Introduction to reading execution plans
Parameter Sniffing: the Good, the Bad, and the Ugly
Dave Bland LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave Bland LinkedIn
Query Processing CSD305 Advanced Databases.
SAG Infotech Private Limited
Introduction to Execution Plans
Parameter Sniffing: the Good,the Bad, and the Ugly
Parameter Sniffing: the Good, the Bad, and the Ugly
Query Tuning Fundamentals
“Magic numbers”, local variable and performance
EXECUTION PLANS Quick Dive.
Execution plans Eugene
Welcome to WebEx Thanks to the NHS Institute for Innovation & Improvement for their contribution to this document.
Insight through Spatial Data
Diving into Query Execution Plans
Query Profiling Options in SQL Server
Crash course on Better SQL Development
Introduction to Execution Plans
From adaptive to intelligent: query processing in SQL Server 2019
Query Optimization Techniques
Reading execution plans successfully
ECU Foundation Xtender Application
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
Performance Tuning for SQL Developers through Execution Plans
From adaptive to intelligent:
Performance Tuning for SQL Developers through Execution Plans
Presentation transcript:

Performance Tuning for SQL Developers through Execution Plans Vladimir Oselsky Performance Tuning for SQL Developers through Execution Plans

About the Speaker Vladimir Oselsky (Vlady) @VladyOselsky (Twitter), voselsky (LinkedIn) https://dg-sql.blogspot.com/ Born and raised in Siberia (it does get cold, and sometimes hot) B.S. Software Engineering Technology (I know some .NET) Various IT Jobs since 1998. Starting in 2010 worked with SQL Server and Oracle.

Execution Plans Is an attempt of SQL Server optimizer to calculate the most optimal route to retrieve the data. Estimated Plan: Possible plan SQL Server will use when executing a query. Actual Plan: Actual plan SQL Server used when executing a query.

Execution Plan Graphical Text XML Graphical representation of steps SQL Server took to execute the query. (Easy to Read) Text Textual representation of steps, containing details about every operation. (Hard to Read) SHOWPLAN_ALL, SHOWPLAN_TEXT, STATISTICS PROFILE XML XML representation of steps outlined in structured way. (Maybe easy for some)

Plan Cache Plan Cache – The place SQL Server stores actual and estimated plans. Lazywriter – process that cleans up plans from Plan Cache based on age and complexity. DBCC FREEPROCCACHE – command to clear plan cache (DO NOT RUN IN PROD)

Plan Basics Button for displaying Estimated Execution Plan

Plan Basics Plans are read from RIGHT to LEFT. Note: Mention extra time to run Query.

Plan Basics To get more details need to hover over specific icons or view properties screen Note: Mention extra time to run Query.

Plan Basics To get more details need to hover over specific icons or view properties screen Note: Mention extra time to run Query.

Plan Basics Text plan. Note: Mention extra time to run Query.

Plan Basics STATISTICS IO – Outputs information related to execution to messages tab Note: Mention extra time to run Query.

Plan Basics STATISTICS TIME – Outputs information related to execution to messages tab Note: Mention extra time to run Query.

Plan Basics XML Plan – One options is to run SHOWPLAN_XML command or right click on Actual Plan and select Show PLAN XML Option Note: Mention extra time to run Query.

XML Plan Note: Mention extra time to run Query.

Stored Plans System views can used to retrieve stored plans – DEMO 01 SELECT [cp].[refcounts] , [cp].[usecounts] , [cp].[objtype] , [st].[dbid] , [st].[objectid] , [st].[text] , [qp].[query_plan] FROM sys.dm_exec_cached_plans cp CROSS APPLY sys.dm_exec_sql_text( cp.plan_handle ) st CROSS APPLY sys.dm_exec_query_plan( cp.plan_handle ) qp; Note: Mention extra time to run Query.

Plan vs Plan Estimated vs Actual may be different Stale Statistics Estimated Plans are invalid - DEMO 02 Cost for Parallelism is reached Note: Mention extra time to run Query.

Graphical Plan Explained Reference Material for further reading List of all operators for SQL Server 2008R2 https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms175913(v=sql.105) List of all operators for SQL Server 2017 https://docs.microsoft.com/en-us/sql/relational-databases/showplan-logical-and-physical-operators-reference?view=sql-server-2017 Note: Mention extra time to run Query.

Possible Problems Scan Operations Note: Mention extra time to run Query.

Possible Problems Other performance hindering candidates Note: Mention extra time to run Query.

Possible Problems Other performance hindering candidates Note: Mention extra time to run Query.

Possible Problems Physical JOIN Operations – DEMO 03 HASH MERGE LOOP Note: Mention extra time to run Query.

Possible Problems IMPLICIT CONVERSION – DEMO 04 Note: Mention extra time to run Query.

SentryOne Demo Download: https://www.sentryone.com/plan-explorer

Q&A Send questions to: vlady.oselsky@gmail.com Blog: https://dg-sql.blogspot.com/ Twitter: @VladyOselsky Thank you

Presentation has ended. Error code #20181120 If you like to know more, feel free to email questions to: Vlady.Oselsky@gmail.com NOTE: All communication sent to incorrect address will be ignored.