Copyright © 2004 Pearson Education, Inc.. Chapter 15 Algorithms for Query Processing and Optimization.

Slides:



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

Copyright © 2004 Pearson Education, Inc.. Chapter 13 Disk Storage, Basic File Structures, and Hashing.
Binary Operations in Relational Algebra & SQL
Copyright © 2004 Ramez Elmasri and Shamkant Navathe Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 15-1 Query Processing and.
Copyright © 2004 Pearson Education, Inc.. Chapter 9 More SQL: Assertions, Views, and Programming Techniques.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 19 Algorithms for Query Processing and Optimization.
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
Copyright © 2004 Pearson Education, Inc.. Chapter 23 Database Security and Authorization.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 6- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 2- 1.
Copyright © 2004 Pearson Education, Inc.. Chapter 5 The Relational Data Model and Relational Database Constraints.
Copyright © 2004 Pearson Education, Inc.. Chapter 14 Indexing Structures for Files.
Copyright © 2004 Pearson Education, Inc.. Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 9- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 14 An Overview of Query Optimization. Copyright © 2005 Pearson Addison-Wesley. All rights reserved Figure 14.1 Typical architecture for.
Copyright © 2008 Pearson Education, Inc. Chapter R Algebra Reference Copyright © 2008 Pearson Education, Inc.
Copyright © 2004 Pearson Education, Inc.. Chapter 11 Relational Database Design Algorithms and Further Dependencies.
Copyright © 2004 Pearson Education, Inc.. Chapter 4 Enhanced Entity- Relationship and UML Modeling.
Copyright © 2004 Pearson Education, Inc.. Chapter 1 Introduction and Conceptual Modeling.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2004 Pearson Education, Inc.. Chapter 2 Database System Concepts and Architecture.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2004 Pearson Education, Inc.. Chapter 12 Practice Database Design Methodology and Use of UML Diagrams.
Copyright © 2004 Pearson Education, Inc.. Chapter 6 The Relational Algebra and Relational Calculus.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
Copyright © 2004 Pearson Education, Inc.. Chapter 12 Practical Database Design Methodology and Use of UML Diagrams.
Copyright © 2004 Pearson Education, Inc.. Chapter 3 Data Modeling Using the Entity-Relationship Model.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2008 Pearson Education, Inc. Chapter 13 The Trigonometric Functions Copyright © 2008 Pearson Education, Inc.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Copyright © 2004 Pearson Education, Inc.. Chapter 27 Data Mining Concepts.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2004 Pearson Education, Inc.. Chapter 8 SQL-99: Schema Definition, Basic Constraints, and Queries.
Copyright © 2004 Pearson Education, Inc.. Chapter 18 Concurrency Control Techniques.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2004 Pearson Education, Inc.. Chapter 19 Database Recovery Techniques.
Copyright © 2004 Pearson Education, Inc.. Chapter 17 Introduction to Transaction Processing Concepts and Theory.
Copyright © 2004 Pearson Education, Inc.. Chapter 25 Distributed Databases and Client–Server Architectures.
Slide Dr. Almetwally Mohamad Mostafa spx is335.
Chapter 21 B Mapping to ODL Copyright © 2004 Pearson Education, Inc.
Copyright © 2004 Pearson Education, Inc.. Chapter 15 Algorithms for Query Processing and Optimization.
CSE314 Database Systems The Relational Algebra and Relational Calculus Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Copyright © 2004 Pearson Education, Inc.. Chapter 26 XML and Internet Databases.
Copyright © 2004 Pearson Education, Inc.. Chapter 28 Overview of Data Warehousing and OLAP.
Copyright © 2004 Pearson Education, Inc.. Chapter 27 Data Mining Concepts.
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
Copyright © 2004 Pearson Education, Inc.. Chapter 21 Object Database Standards, Languages, and Design.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 Part a The Relational Algebra and Relational Calculus Hours 1,2.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 The Relational Algebra and Relational Calculus.
Al-Maarefa College for Science and Technology INFO 232: Database systems Chapter 3 “part 2” The Relational Algebra and Calculus Instructor Ms. Arwa Binsaleh.
Copyright © 2004 Pearson Education, Inc.. Chapter 22 Object-Relational and Extended-Relational Systems.
Query Processing – Query Trees. Evaluation of SQL Conceptual order of evaluation – Cartesian product of all tables in from clause – Rows not satisfying.
1 2 Concepts of Database Management, 4 th Edition, Pratt & Adamski Chapter 2 The Relational Model 1: Introduction, QBE, and Relational Algebra.
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
Copyright © 2004 Pearson Education, Inc.. Chapter 6 The Relational Algebra and Relational Calculus.
Copyright © 2004 Pearson Education, Inc.. Chapter 25 Distributed Databases and Client-Server Architectures.
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Introduction to Query Processing (1) Query optimization: The process of choosing a suitable execution.
Copyright © 2004 Pearson Education, Inc.. Chapter 24 Enhanced Data Models for Advanced Applications.
Copyright © 2004 Pearson Education, Inc.. Chapter 17 Introduction to Transaction Processing Concepts and Theory.
Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc.
Copyright © 2004 Pearson Education, Inc.. Chapter 24 Enhanced Data Models for Advanced Applications.
CSE202 Database Management Systems
Query Processing and Optimization, and Database Tuning
Presentation transcript:

Copyright © 2004 Pearson Education, Inc.

Chapter 15 Algorithms for Query Processing and Optimization

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-3 FIGURE 15.1 Typical steps when processing a high- level query.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-4 FIGURE 15.2 Outline of the sort-merge algorithm for external sorting.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-5 FIGURE 15.3 Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sort- merge, where R has n tuples and S has m tuples. (a) Implementing the operation T  R A=B S.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-6 FIGURE 15.3 (continued) Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sort- merge, where R has n tuples and S has m tuples. (b) Implementing the operation T   (R).

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-7 FIGURE 15.3 (continued) Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sort- merge, where R has n tuples and S has m tuples. (c) Implementing the operation T  R  S.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-8 FIGURE 15.3 (continued) Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sort- merge, where R has n tuples and S has m tuples. (d) Implementing the operation T  R  S.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-9 FIGURE 15.3 (continued) Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sort- merge, where R has n tuples and S has m tuples. (e) Implementing the operation T  R – S.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.4 Two query trees for the query Q2. (a) Query tree corresponding to the relational algebra expression for Q2.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.4 (continued) Two query trees for the query Q2. (b) Initial (canonical) query tree for SQL query Q2.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.4 (continued) Two query trees for the query Q2. (c) Query graph for Q2.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.5 Steps in converting a query tree during heuristic optimization. (a) Initial (canonical) query tree for SQL query Q.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.5 (continued) Steps in converting a query tree during heuristic optimization. (b) Moving SELECT operations down the query tree.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.5 (continued) Steps in converting a query tree during heuristic optimization. (c) Applying the more restrictive SELECT operation first.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.5 (continued) Steps in converting a query tree during heuristic optimization. (d) Replacing CARTESIAN PRODUCT and SELECT with JOIN operations.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.5 (continued) Steps in converting a query tree during heuristic optimization. (e) Moving PROJECT opeations down the query tree.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.6 A query tree for query Q1.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.7 Two left-deep (join) query trees.

Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide FIGURE 15.8 Sample statistical information for relations in Q2. (a) Column information. (b) Table information. (c) Index information.