Query Optimization.

Slides:



Advertisements
Similar presentations
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Advertisements

Query Optimization Reserves Sailors sid=sid bid=100 rating > 5 sname (Simple Nested Loops) Imperative query execution plan: SELECT S.sname FROM Reserves.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
CS CS4432: Database Systems II Logical Plan Rewriting.
Query Optimization May 31st, Today A few last transformations Size estimation Join ordering Summary of optimization.
Copyright © 2004 Ramez Elmasri and Shamkant Navathe Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 15-1 Query Processing and.
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
Query Optimization CS634 Lecture 12, Mar 12, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Distributed DBMS© M. T. Özsu & P. Valduriez Ch.6/1 Outline Introduction Background Distributed Database Design Database Integration Semantic Data Control.
CS 540 Database Management Systems
Query Optimization Goal: Declarative SQL query
Wrapup Amol Deshpande CMSC424. “Inventing the Future” Wednesday at 3:30pm 1115 CSIC Exam.
Query Rewrite: Predicate Pushdown (through grouping) Select bid, Max(age) From Reserves R, Sailors S Where R.sid=S.sid GroupBy bid Having Max(age) > 40.
Cs44321 CS4432: Database Systems II Query Optimizer – Cost Based Optimization.
CS263 Lecture 19 Query Optimisation.  Motivation for Query Optimisation  Phases of Query Processing  Query Trees  RA Transformation Rules  Heuristic.
Database management concepts Database Management Systems (DBMS) An example of a database (relational) Database schema (e.g. relational) Data independence.
Query Optimization: Transformations May 29 th, 2002.
CMSC724: Database Management Systems Instructor: Amol Deshpande
Summary. Chapter 9 – Triggers Integrity constraints Enforcing IC with different techniques –Keys –Foreign keys –Attribute-based constraints –Schema-based.
Summary of query compilers (Section16.8) Varun Gupta Department of Computer Science ID-216 CS 257.
...Looking back Why use a DBMS? How to design a database? How to query a database? How does a DBMS work?
T HE Q UERY C OMPILER Prepared by : Ankit Patel (226)
CS 255: Database System Principles slides: From Parse Trees to Logical Query Plans By:- Arunesh Joshi Id:
Query Processing Presented by Aung S. Win.
Practical Database Design and Tuning. Outline  Practical Database Design and Tuning Physical Database Design in Relational Databases An Overview of Database.
Context Tailoring the DBMS –To support particular applications Beyond alphanumerical data Beyond retrieve + process –To support particular hardware New.
Physical Database Design Chapter 6. Physical Design and implementation 1.Translate global logical data model for target DBMS  1.1Design base relations.
Access Path Selection in a Relational Database Management System Selinger et al.
Introduction to Database Systems Fundamental Concepts Irvanizam Zamanhuri, M.Sc Computer Science Study Program Syiah Kuala University Website:
Database Management 9. course. Execution of queries.
Copyright © 2004 Pearson Education, Inc.. Chapter 15 Algorithms for Query Processing and Optimization.
Query Processing and Optimization
Intro – Part 2 Introduction to Database Management: Ch 1 & 2.
Query Optimization March 10 th, Very Big Picture A query execution plan is a program. There are many of them. The optimizer is trying to chose a.
Database Environment Chapter 2. Data Independence Sometimes the way data are physically organized depends on the requirements of the application. Result:
Query Processing – Query Trees. Evaluation of SQL Conceptual order of evaluation – Cartesian product of all tables in from clause – Rows not satisfying.
CSCI Query Processing1 QUERY PROCESSING & OPTIMIZATION Dr. Awad Khalil Computer Science Department AUC.
Lecture 15: Query Optimization. Very Big Picture Usually, there are many possible query execution plans. The optimizer is trying to chose a good one.
Welcome to CPSC 534B: Information Integration Laks V.S. Lakshmanan Rm. 315.
1 Storing and Maintaining Semistructured Data Efficiently in an Object- Relational Database Mo Yuanying and Ling Tok Wang.
CHAPTER 19 Query Optimization. CHAPTER 19 Query Optimization.
Database Applications (15-415) DBMS Internals- Part VIII Lecture 17, Oct 30, 2016 Mohammad Hammoud.
Practical Database Design and Tuning
Logic as a Query Language: from Frege to XML
Chapter 2 Database Environment.
Chapter 1: Introduction
Prepared by : Ankit Patel (226)
CS222P: Principles of Data Management Lecture #15 Query Optimization (System-R) Instructor: Chen Li.
Database Performance Tuning and Query Optimization
Chapter 15 QUERY EXECUTION.
Advanced Database Models
Chapter 2 Database Environment.
Examples of Physical Query Plan Alternatives
Cse 344 May 7th – Exam Review.
Chapter 2 Database Environment Pearson Education © 2009.
April 20th – RDBMS Internals
Database management concepts
Practical Database Design and Tuning
Database Applications (15-415) DBMS Internals- Part IX Lecture 21, April 1, 2018 Mohammad Hammoud.
Introduction to Database Systems CSE 444 Lecture 23: Final Review
Query Optimization and Perspectives
Database management concepts
Chapter 11 Database Performance Tuning and Query Optimization
A Framework for Testing Query Transformation Rules
Query Processing.
Chapter 2 Database Environment Pearson Education © 2009.
Introduction to Database Systems CSE 444 Lecture 23: Final Review
CS222: Principles of Data Management Lecture #15 Query Optimization (System-R) Instructor: Chen Li.
Chapter 2 Database Environment Pearson Education © 2009.
Translating Imperative Code into SQL
Presentation transcript:

Query Optimization

Very Big Picture A query execution plan is a program. There are many of them. The optimizer is trying to chose a good one. Hence, the optimizer is reasoning about programs. Key: cost model, search space. Compilers don’t have cost models. Why?

More Detail, but Still Big Picture Parse the SQL query into a logical tree: identify distinct blocks (corresponding to nested sub-queries or views). Query rewrite phase: SQL-to-SQL transforms apply algebraic transformations to yield a cheaper plan. Merge blocks and move predicates between blocks. Optimize each block: join ordering. Complete the optimization: select scheduling (pipelining strategy).

Query Rewrite Summary The optimizer can use any semantically correct rule to transform one query to another. Rules try to: move constraints between blocks (because each will be optimized separately) Unnest blocks Especially important in decision support applications where queries are very complex. Rules can be very tricky!

The Course in Perspective The relational data model, SQL Views, updates, transactions Conceptual design Expressing the constraints on the domain Using them to get good schema designs XML A format for data exchange. Has its own query language. Basis for web services.

Perspective (continued) Building a database system: Storage and indexing Query execution (join algorithms) Query optimization Data integration and sharing: Databases were created independently Schemas need to be matched Need to access multiple databases in one query.