The query processor does what the query plan tells it to do A “good” query plan is essential for a well- performing.

Slides:



Advertisements
Similar presentations
Using the Optimizer to Generate an Effective Regression Suite: A First Step Murali M. Krishna Presented by Harumi Kuno HP.
Advertisements

CS 540 Database Management Systems
EXECUTION PLANS By Nimesh Shah, Amit Bhawnani. Outline  What is execution plan  How are execution plans created  How to get an execution plan  Graphical.
Module 14: Analyzing Queries. Overview Queries That Use the AND Operator the OR Operator Join Operations.
David Konopnicki Choosing Access Path ä The basic methods. ä The access paths and when they are available. ä How the optimizer chooses among the.
Virtual techdays INDIA │ 9-11 February 2011 SQL 2008 Query Tuning Praveen Srivatsa │ Principal SME – StudyDesk91 │ Director, AsthraSoft Consulting │ Microsoft.
Tempdb Parasites Jason Hall-Dir. of Client SQL Sentry Blog-jasonhall.blogs.sqlsentry.net.
Query Execution Chapter 15 Section 15.1 Presented by Khadke, Suvarna CS 257 (Section II) Id
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.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
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.
Data Partitioning in VLDB Tal Olier
Applications hitting a wall today with SQL Server Locking/Latching Scale-up Throughput or latency SLA Applications which do not use SQL Server.
Query Processing. Steps in Query Processing Validate and translate the query –Good syntax. –All referenced relations exist. –Translate the SQL to relational.
Star Transformations Tony Hasler, UKOUG Birmingham 2012 Tony Hasler, Anvil Computer Services Ltd.
Parallel Execution Plans Joe Chang
1 Chapter 10 Joins and Subqueries. 2 Joins & Subqueries Joins – Methods to combine data from multiple tables – Optimizer information can be limited based.
Oracle tuning: a tutorial Saikat Chakraborty. Introduction In this session we will try to learn how to write optimized SQL statements in Oracle 8i We.
Around the world (of query plan operators) in 50 minutes David Morrison BI Consultant.
Indexes and Views Unit 7.
© IBM Corporation 2005 Informix User Forum 2005 John F. Miller III Explaining SQLEXPLAIN ®
CS 257 Chapter – 15.9 Summary of Query Execution Database Systems: The Complete Book Krishna Vellanki 124.
CPS216: Advanced Database Systems Notes 09:Query Optimization (Cost-based optimization) Shivnath Babu.
SQL/Lesson 7/Slide 1 of 32 Implementing Indexes Objectives In this lesson, you will learn to: * Create a clustered index * Create a nonclustered index.
Creating Indexes on Tables An index provides quick access to data in a table, based on the values in specified columns. A table can have more than one.
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.
CS 440 Database Management Systems Lecture 5: Query Processing 1.
CS 540 Database Management Systems
Oracle9i Developer: PL/SQL Programming Chapter 11 Performance Tuning.
Eugene Meidinger Execution Plans
Common SQL Performance Issues AND HOW TO AVOID OR FIX THEM.
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 IMPLEMENTATION & ADMINISTRATION Indexing & Views.
CS 440 Database Management Systems
Query Tuning without Production Data
Choosing Access Path The basic methods.
Introduction to Execution Plans
Chapter 15 QUERY EXECUTION.
Query Execution Presented by Khadke, Suvarna CS 257
Evaluation of Relational Operations: Other Operations
The Key to the Database Engine
Physical Join Operators
Physical Database Design
Execution Plans Demystified
SQL Server 2016 Execution Plan Analysis Liviu Ieran
SQL Server Query Plans Journeyman and Beyond
Introduction to reading execution plans
Dave Bland LinkedIn SQL Server Execution Plans: How to use them to find performance bottlenecks Dave Bland LinkedIn
Four Rules For Columnstore Query Performance
Query Execution Presented by Jiten Oswal CS 257 Chapter 15
Introduction to Execution Plans
Implementation of Relational Operations
EXECUTION PLANS Quick Dive.
Execution plans Eugene
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.
Presentation transcript:

The query processor does what the query plan tells it to do A “good” query plan is essential for a well- performing query We must learn to identify and fix the mistakes The optimizer makes mistakes

LOGIC Flows Left-to-Right DATA Flows Right-to-Left

Iterators expose row and execution estimates Slow plan? Analyze estimates against actual values Important: Cost is always an estimate! Actuals and estimates way off? Try updating statistics

Thicker lines means more rows Make thick lines thinner, further to the right, for faster plans!

Slow Plan? Start here… Bonus Iterator! Scan

Your nonclustered index handles your search argument… … but you’re referencing at least one column that’s not included Lots of rows? You’ve got a problem

Used as a “cache” in the query processor Lack of adequate indexes or uniqueness information Implemented as hidden tables in tempdb Almost never a good sign

ORDER BY, Merge Join, Stream Agg, Windowing Performs worse, relative to input size, as input size increases Check expectations and indexes! Do you really need that sort?

Aggregation and join methodology Linear scale, but may heavily impact tempdb Common in warehouses Generally not good for OLTP

Basic join methodology Works best with a small outer (top) input Never-ending “hung” queries? Almost always inappropriate nested loops!

Much reviled by DBAs Often appropriate Check your predicates and expectations!

Most plan problems boil down to a simple set of issues Don’t let yourself get overwhelmed Most of all, have fun! Query tuning is a satisfying endeavor Focus on the obvious: lots of rows and problematic iterators