The Key to the Database Engine

Slides:



Advertisements
Similar presentations
Understanding SQL Server Query Execution Plans
Advertisements

SQL Performance 2011/12 Joe Chang, SolidQ
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.
Dos and don’ts of Columnstore indexes The basis of xVelocity in-memory technology What’s it all about The compression methods (RLE / Dictionary encoding)
Eugene Meidinger Execution Plans
Virtual techdays INDIA │ 9-11 February 2011 SQL 2008 Query Tuning Praveen Srivatsa │ Principal SME – StudyDesk91 │ Director, AsthraSoft Consulting │ Microsoft.
The query processor does what the query plan tells it to do A “good” query plan is essential for a well- performing.
Relational Database Performance CSCI 6442 Copyright 2013, David C. Roberts, all rights reserved.
Executing Explain Plans and Explaining Execution Plans Craig Martin 01/20/2011.
Physical Database Design & Performance. Optimizing for Query Performance For DBs with high retrieval traffic as compared to maintenance traffic, optimizing.
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.
Around the world (of query plan operators) in 50 minutes David Morrison BI Consultant.
Indexes and Views Unit 7.
Query Optimization CMPE 226 Database Systems By, Arjun Gangisetty
Eugene Meidinger Execution Plans
Dave LinkedIn
How to kill SQL Server Performance Håkan Winther.
OM. Platinum Level Sponsors Gold Level Sponsors Pre Conference Sponsor Venue Sponsor Key Note Sponsor.
Execution Plans for Mere Mortals A beginners look at execution plans. Mike Lawell, Teammate, Linchpin People.
Scott Fallen Sales Engineer, SQL Sentry Blog: scottfallen.blogspot.com.
Execution Plans Detail From Zero to Hero İsmail Adar.
Diving into Query Execution Plans ED POLLACK AUTOTASK CORPORATION DATABASE OPTIMIZATION ENGINEER.
Indexing strategies and good physical designs for performance tuning Kenneth Ureña /SpanishPASSVC.
Just Enough Database Theory for Power Pivot / Power BI
SQL Server Statistics and its relationship with Query Optimizer
Power BI Internals Eugene
An Introductory Look at Execution Plans
15.1 – Introduction to physical-Query-plan operators
Indexes By Adrienne Watt.
Execution Planning for Success
T-SQL: Simple Changes That Go a Long Way
Reading execution plans successfully
Database Performance Tuning and Query Optimization
Reading Execution Plans Successfully
Introduction to Execution Plans
Chapter 15 QUERY EXECUTION.
Power BI Performance …Tips and Techniques.
Examples of Physical Query Plan Alternatives
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
Execution Plans Demystified
Steve Hood SimpleSQLServer.com
SQL Server 2016 Execution Plan Analysis Liviu Ieran
Reading Execution Plans Successfully
SQL Server Query Plans Journeyman and Beyond
Indexing for Beginners
Introduction to reading execution plans
Dave Bland LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave Bland LinkedIn
Query Processing CSD305 Advanced Databases.
Four Rules For Columnstore Query Performance
Introduction to Execution Plans
Power BI Part 2: Internals
Chapter 11 Database Performance Tuning and Query Optimization
EXECUTION PLANS Quick Dive.
Execution plans Eugene
Diving into Query Execution Plans
Introduction to Execution Plans
SQL Server 2019: What’s new? Eugene Meidinger
The Five Mistakes You are Probably Making with SQL Server
SQL Server Execution Plan Primer
Introduction to power query
Reading execution plans successfully
Introduction to Execution Plans
Welcome!.
All about Indexes Gail Shaw.
The Ins and Outs of Indexes
Presentation transcript:

The Key to the Database Engine Execution Plan Essentials The Key to the Database Engine Eugene Meidinger, BI Consultant, All Lines Technology

BI Consultant, All Lines Technology Went from SQL Newbie to SQL Pro in the last 6 years. Experience with T-SQL, SSRS and Power BI Pluralsight Author Author of video training on Pluralsight. Currently focusing on Power BI content Eugene Meidinger BI Consultant, All Lines Technology Pittsburgh PUG co-leader Help lead the Pittsburgh Power BI User Group. /eugenemeidinger @sqlgene

Agenda This is an introductory session on execution plans. What are execution plans? How do you read them? What do the operators mean? What’s new since SQL Server 2012? Demos, Demos, Demos

What are Execution Plans? An execution plan represents the steps the database engine takes. When the Database Engine processes a query, it creates a series of steps You can think of this like a recipe, or driving directions Execution plans give you insight into the choices the engine made Some plans can be wildly inefficient (human error, bad statistics, etc.) Execution plans are cached for future runs

Database Engines are like GPS Devices You use a GPS device to tell you how to get from point A to point B as efficiently as possible A driving plan is a series of steps or operations (turn left, turn right, go straight, etc.) A driving plan has a set of costs (miles, gas, time, tolls, etc.) A GPS device usually provides multiple options, with different costs Part of the Database Engine works to figure out how to get data from disk to the client as efficiently as possible An execution plan is a series of steps or operations (Index scan, filter data, SELECT) An execution plan has a set of costs (IO, CPU, RAM, time) The database engine will produce multiple potential execution plans

How Do We View Execution Plans? We have three different options. 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 It’s a roadmap for your data. Read from right to left and top to bottom Imagine everyone driving towards the SELECT Icons represent operators Thinks of operators as turns on your road trip Operators have costs below them Arrow represent data flow Think of them as traffic indicators Bigger arrows mean more rows Hover over icons and arrows for more detail

Missing Indexes The database engine will suggest missing indexes.

Types of Operators There are a few broad categories. Gathering Data Joining Data Manipulating Data MISC

Gathering Data This is the starting point for any execution plan. Table scan Clustered index scan Clustered index seek Nonclustered index scan Nonclustered index seek RID lookup Key lookup

SARGability When can you use your indexes? SARGability (Search Argument) means your query can use your indexes. Imagine if I asked for all the Smiths from the phonebook. That’s SARGable. Imagine if I asked for all Last names with an R. That’s not SARGable. Manipulating a column in your where clause can break SARGability.

Joining Data There are three types of joins Nested Loop Join Ideal when one dataset is small Merge Join Ideal when both datasets are sorted Hash Join Ideal for large datasets Memory intensive!!!

Manipulating Data There are a lot of ways to manipulate data. These are a few. Compute Scalar Filter Sort Top

What’s new? A lot has changed since 2008 R2. Compare Showplan Cardinality Estimator Row Level Security Live Query Statistics Query Store Adaptive Query Plans

Execution Plans Demo

Learn more from Eugene Meidinger @sqlgene eugene@eugenemeidinger.com