Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
Copyright © 2004 Pearson Education, Inc. Chapter 15 Algorithms for Query Processing and Optimization Copyright © 2004 Pearson Education, Inc. FIGURE 15.1 Typical steps when processing a highlevel query. Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-3 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-4 FIGURE 15.3 Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sortmerge, where R has n tuples and S has m tuples. (a) Implementing the operation T R <project> A=BS. Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-5 FIGURE 15.3 (continued) Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sortmerge, where R has n tuples and S has m tuples. (b) Implementing the operation T <attribute list>(R). 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 sortmerge, 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-7 FIGURE 15.3 (continued) Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sortmerge, 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-8 FIGURE 15.3 (continued) Implementation JOIN, PROJECT, UNION, INTERSECTION, and SET DIFFERENCE by using sortmerge, 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 15-9 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 15-10 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 15-11 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 15-12 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 15-13 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 15-14 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 15-15 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 15-16 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 15-17 FIGURE 15.6 A query tree for query Q1. Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-18 FIGURE 15.7 Two left-deep (join) query trees. Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-19 FIGURE 15.8 Sample statistical information for relations in Q2. (a) Column information. (b) Table information. (c) Index information. Elmasri and Navathe, Fundamentals of Database Systems, Fourth Edition Copyright © 2004 Pearson Education, Inc. Slide 15-20