Execution plans Eugene

Slides:



Advertisements
Similar presentations
Understanding SQL Server Query Execution Plans
Advertisements

Basic Execution Plans Eugene
EXECUTION PLANS By Nimesh Shah, Amit Bhawnani. Outline  What is execution plan  How are execution plans created  How to get an execution plan  Graphical.
Eugene Meidinger Execution Plans
Virtual techdays INDIA │ 9-11 February 2011 SQL 2008 Query Tuning Praveen Srivatsa │ Principal SME – StudyDesk91 │ Director, AsthraSoft Consulting │ Microsoft.
Executing Explain Plans and Explaining Execution Plans Craig Martin 01/20/2011.
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.
T-SQL: Simple Changes That Go a Long Way DAVE ingeniousSQL.com linkedin.com/in/ingenioussql.
Query Optimizer Execution Plan Cost Model Joe Chang
Indexes and Views Unit 7.
Eugene Meidinger Execution Plans
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Execution Plans Detail From Zero to Hero İsmail Adar.
LAB: Web-scale Data Management on a Cloud Lab 11. Query Execution Plan 2011/05/27.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
Eugene Meidinger Power BI: Start to
SQL IMPLEMENTATION & ADMINISTRATION Indexing & Views.
Eugene Meidinger Intermediate Querying: Going Beyond Select
Power BI: Getting Started and Keeping Up
Pittsburgh Power BI Group
Just Enough Database Theory for Power Pivot / Power BI
Power BI Internals Eugene
An Introductory Look at Execution Plans
An (Advanced) Introduction to DAX
Execution Planning for Success
An (Advanced) Introduction to DAX
T-SQL: Simple Changes That Go a Long Way
Reading execution plans successfully
Hustle and Bustle of SQL Pages
Reading Execution Plans Successfully
Four Rules For Columnstore Query Performance
Introduction to Execution Plans
Power BI Performance …Tips and Techniques.
Marcos Freccia Stop everything! Top T-SQL tricks to a developer
The Vocabulary of Performance Tuning
The Key to the Database Engine
Cardinality Estimator 2014/2016
Power BI Deployment: Scaling from 5 to 5000
Execution Plans Demystified
SQL Server 2016 Execution Plan Analysis Liviu Ieran
Reading Execution Plans Successfully
SQL Server Query Plans Journeyman and Beyond
The PROCESS of Queries John Deardurff Website: ThatAwesomeTrainer.com
Introduction to reading execution plans
SQL Server Query Optimizer Cost Formulas
The PROCESS of Queries John Deardurff
Dave Bland LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave Bland LinkedIn
Four Rules For Columnstore Query Performance
Introduction to Execution Plans
Power BI Part 1: A Business User’s Perspective
Power BI Part 2: Internals
EXECUTION PLANS Quick Dive.
Diving into Query Execution Plans
Introduction to Execution Plans
Power BI: Start to Finish
SQL Server 2019: What’s new? Eugene Meidinger
SQL Performance for DBAs
SQL Server Execution Plan Primer
Reading execution plans successfully
Introduction to Execution Plans
Performance Tuning for SQL Developers through Execution Plans
Welcome!.
Performance Tuning ETL Process
Sql Server 2019: what’s new?.
All about Indexes Gail Shaw.
Performance Tuning for SQL Developers through Execution Plans
Performance Tuning for SQL Developers through Execution Plans
Presentation transcript:

Execution plans Eugene Meidinger @sqlgene www.sqlgene.com/powerbi/ emeidinger@all-lines-tech.com

About me Business Intelligence developer Worked for All-Lines for 5 years Spoken at Pittsburgh SQL User Group and various SQL Saturdays Help lead the Pittsburgh Power BI User Group Pluralsight Author Went from SQL newb to SQL pro

Why are execution plans important? They are simple to use They are key to improving query performance They give you insight to the database engine

What is an execution plan? Instructions for how to process a query Can think of it as a recipe Created by the query optimizer at run time Execution plans are cached after the first run Many different ways to process the same query For trivial queries, a simple plan is used Can be forced with hints Don’t try to outsmart the database engine

How to view the execution plan? Go to Query Click Include Actual Execution Plan Or, Press Ctrl + M Or click the execution plan icon on the toolbar

What does a plan look like?

How to read an execution plan Read from right to left and top to bottom Icons represent operators Operators have cost below them Arrows represent data flow Bigger arrows represent more data Hover over icons and arrows for more detail

Reading the Arrows

Reading the Popup box Focus on the top, bottom, cost and estimated versus actual Top explains the operator Bottom is the important detail Est vs. Act can be a problem The rest isn’t important yet

Missing index SQL Server will suggest an index if needed Use with caution

Comparing Queries Query Cost – Relative to Batch Run multiple queries to compare them

Types of operators Gathering Data Joining Data Manipulating Data MISC

Gather data Table scan Clustered index scan Clustered index seek Nonclustered index scan Nonclustered index seek RID lookup Key lookup

Scans and seeks Scan versus seek Clustered versus nonclustered Scan – Going through all of the rows Seek – Going to a specific row Clustered versus nonclustered Clustered – using the whole table Nonclustered – taking advantage of the index Tables versus heaps Key Lookup – uses the primary key to find a row RID Lookup – uses the row number in a heap to find a row

Joins Merge Join – Joins two sorted datasets Nested loop join – Loops a small data set over a larger one Hash join – A hash table is made with the smaller input https://technet.microsoft.com/en-us/library/ms189313(v=sql.105).aspx

Manipulate data Filter Top Sort Compute Scalar

Demo

SQL Server Execution Plans, 2nd edition https://www.red-gate.com/library/sql-server-execution-plans-2nd-edition

SentryOne Plan Explorer https://sentryone.com/plan-explorer