EXECUTION PLANS Quick Dive.

Slides:



Advertisements
Similar presentations
Tuning: overview Rewrite SQL (Leccotech)Leccotech Create Index Redefine Main memory structures (SGA in Oracle) Change the Block Size Materialized Views,
Advertisements

Understanding SQL Server Query Execution Plans
Equality Join R X R.A=S.B S : : Relation R M PagesN Pages Relation S Pr records per page Ps records per page.
Copyright © 2011 Ramez Elmasri and Shamkant Navathe Algorithms for SELECT and JOIN Operations (8) Implementing the JOIN Operation: Join (EQUIJOIN, NATURAL.
1 40T1 60T2 30T3 10T4 20T5 10T6 60T7 40T8 20T9 R S C C R JOIN S?
6.830 Lecture 9 10/1/2014 Join Algorithms. Database Internals Outline Front End Admission Control Connection Management (sql) Parser (parse tree) Rewriter.
Lecture 8 Join Algorithms. Intro Until now, we have used nested loops for joining data – This is slow, n^2 comparisons How can we do better? – Sorting.
EXECUTION PLANS By Nimesh Shah, Amit Bhawnani. Outline  What is execution plan  How are execution plans created  How to get an execution plan  Graphical.
Query Execution, Concluded Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems November 18, 2003 Some slide content may.
Virtual techdays INDIA │ 9-11 February 2011 SQL 2008 Query Tuning Praveen Srivatsa │ Principal SME – StudyDesk91 │ Director, AsthraSoft Consulting │ Microsoft.
CS 4432query processing - lecture 171 CS4432: Database Systems II Lecture #17 Join Processing Algorithms (cont). Professor Elke A. Rundensteiner.
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.
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.
Data Partitioning in VLDB Tal Olier
Primary Key, Cluster Key & Identity Loop, Hash & Merge Joins Joe Chang
Querying Large Databases Rukmini Kaushik. Purpose Research for efficient algorithms and software architectures of query engines.
CS 338Query Evaluation7-1 Query Evaluation Lecture Topics Query interpretation Basic operations Costs of basic operations Examples Textbook Chapter 12.
Status “Lifetime of a Query” –Query Rewrite –Query Optimization –Query Execution Optimization –Use cost-estimation to iterate over all possible plans,
Relational Operator Evaluation. Overview Index Nested Loops Join If there is an index on the join column of one relation (say S), can make it the inner.
RELATIONAL JOIN Advanced Data Structures. Equality Joins With One Join Column External Sorting 2 SELECT * FROM Reserves R1, Sailors S1 WHERE R1.sid=S1.sid.
Dive into the Query Optimizer Dive into the Query Optimizer: Undocumented Insight Benjamin Nevarez Blog: benjaminnevarez.com
SQL Performance and Optimization l SQL Overview l Performance Tuning Process l SQL-Tuning –EXPLAIN PLANs –Tuning Tools –Optimizing Table Scans –Optimizing.
1 Chapter 10 Joins and Subqueries. 2 Joins & Subqueries Joins – Methods to combine data from multiple tables – Optimizer information can be limited based.
Around the world (of query plan operators) in 50 minutes David Morrison BI Consultant.
Query Optimization CMPE 226 Database Systems By, Arjun Gangisetty
2010 Ami Levin. SQL Server implements three different physical operators to perform joins. In this session we will see how each of these three operators.
David Konopnicki –1997, Rev. MS Optimizing Join Statements To choose an execution plan for a join statement, the optimizer must choose: ä Access.
Sorting and Joining.
MapReduce Joins Shalish.V.J. A Refresher on Joins A join is an operation that combines records from two or more data sets based on a field or set of fields,
Query Processing – Implementing Set Operations and Joins Chap. 19.
Relational Operator Evaluation. overview Projection Two steps –Remove unwanted attributes –Eliminate any duplicate tuples The expensive part is removing.
Query Processing and Query Optimization CS 157B Dennis Le Weishan Wang.
Fan Qi Database Lab 1, com1 #01-08 CS3223 Tutorial 6.
Eugene Meidinger Execution Plans
How to kill SQL Server Performance Håkan Winther.
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.
Tuning Oracle SQL The Basics of Efficient SQL Common Sense Indexing
CS 540 Database Management Systems
CS 440 Database Management Systems
T-SQL: Simple Changes That Go a Long Way
Introduction to Execution Plans
Evaluation of Relational Operations: Other Operations
Examples of Physical Query Plan Alternatives
The Key to the Database Engine
Physical Join Operators
09_Queries_LECTURE2 CODE GENERATION implements the operator, JOIN (equi-join, we will use  for it.) J1. NESTED LOOP JOIN S on S.S#=E.S# For each record.
JULIE McLAIN-HARPER LINKEDIN: JM HARPER
SQL Server 2016 Execution Plan Analysis Liviu Ieran
Performance Join Operator Select * from R, S where R.a = S.a;
Introduction to reading execution plans
Dave Bland LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave Bland LinkedIn
Introduction to Execution Plans
Implementation of Relational Operations
CS505: Intermediate Topics in Database Systems
Execution plans Eugene
Evaluation of Relational Operations: Other Techniques
Diving into Query Execution Plans
Introduction to Execution Plans
Introduction to Execution Plans
Evaluation of Relational Operations: Other Techniques
Welcome!.
All about Indexes Gail Shaw.
The Ins and Outs of Indexes
Presentation transcript:

EXECUTION PLANS Quick Dive

ABOUT ME @shawsql http://www.blogofshaw.blogspot.com/

I OWE EVERYTHING TO…

WHAT WE WON’T TALK ABOUT Execution plan cache Performance tuning DMV’s (maybe a little) XML, parallelism, partitioning, etc. Statistics Politics

KEY CONCEPTS T-SQL is non-procedural This means the language does not tell how to retrieve the data Execution Plans are cost-based This means even a good plan may not necessarily be the best plan and the best plan may never be known Execution Plans are broken up into logical and physical operators Logical operations are expressed by physical operations

EXECUTION PROCESS

EXECUTION PLANS Each step in an execution plan is a physical operator Plans read from left to right Bar thickness represents amount of data Outer tables on top, inner tables on bottom Plans are either “trivial” or “full”

DEMO Trivial Plans Index\Table Scans\Seeks Bookmark Lookups

JOIN TYPES Hash - Build table and probe table - In memory, grace, recursive Nested Loops - Outer table and inner table - Best when outer input is small and inner output is indexed

JOIN TYPES Merge - Each input is sorted - Best for large, pre-sorted tables

DEMO Join Types

TOOL TIP TIME A lot of information but most not necessarily relevant.

Best Practices Locate the step with the highest cost Eliminate table scans Update statistics Avoid bookmark lookups by using clustered indexes or covering indexes