Database-19-QueryProcessing.pptx

4 using rule 12 combine a cartesian product operation

Info icon This preview shows pages 48–55. Sign up to view the full content.

4. Using Rule 12, combine a Cartesian product operation with a subsequent select operation in the tree into a join operation. 5. Using rules 3, 4, 7, and 11 concerning the cascading of project and the commuting of project with other operations, break down and move lists of projection attributes down the tree as far as possible by creating new project operations as needed. 6. Identify subtrees that represent groups of operations that can be executed by a single algorithm. Query Processing and Optimization 48
Image of page 48

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Using Heuristics in Query Optimization Summary of Heuristics for Algebraic Optimization: 1. The main heuristic is to apply first the operations that reduce the size of intermediate results. 2. Perform select operations as early as possible to reduce the number of tuples and perform project operations as early as possible to reduce the number of attributes. (This is done by moving select and project operations as far down the tree as possible.) 3. The select and join operations that are most restrictive should be executed before other similar operations. (This is done by reordering the leaf nodes of the tree among themselves and adjusting the rest of the tree appropriately.) Query Processing and Optimization 49
Image of page 49
Using Heuristics in Query Optimization Query Execution Plans An execution plan for a relational algebra query consists of a combination of the relational algebra query tree and information about the access methods to be used for each relation as well as the methods to be used in computing the relational operators stored in the tree. Materialized evaluation : the result of an operation is stored as a temporary relation. Pipelined evaluation : as the result of an operator is produced, it is forwarded to the next operator in sequence. Query Processing and Optimization 50
Image of page 50

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Using Selectivity and Cost Estimates in Query Optimization Cost-based query optimization : Estimate and compare the costs of executing a query using different execution strategies and choose the strategy with the lowest cost estimate. (Compare to heuristic query optimization) Issues Cost function Number of execution strategies to be considered Query Processing and Optimization 51
Image of page 51
Using Selectivity and Cost Estimates in Query Optimization Cost Components for Query Execution 1. Access cost to secondary storage 2. Storage cost 3. Computation cost 4. Memory usage cost 5. Communication cost Note: Different database systems may focus on different cost components. Query Processing and Optimization 52
Image of page 52

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Using Selectivity and Cost Estimates in Query Optimization Catalog Information used in Cost Functions Information about the size of a file number of records (tuples) (r), record size (R), number of blocks (b) blocking factor (bfr) Information about indexes and indexing attributes of a file Number of levels (x) of each multilevel index Number of first-level index blocks (bI1) Number of distinct values (d) of an attribute Selectivity (sl) of an attribute Selection cardinality (s) of an attribute. (s = sl * r) Query Processing and Optimization 53
Image of page 53
Using Selectivity and Cost Estimates in Query Optimization Examples of Cost Functions for SELECT S1. Linear search (brute force) approach
Image of page 54

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 55
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '09
  • SUNANHAN
  • Query optimizer, JOIN Operations

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern