Presentation is loading. Please wait.

Presentation is loading. Please wait.

Completing the Physical-Query-Plan and Chapter 16 Summary ( )

Similar presentations


Presentation on theme: "Completing the Physical-Query-Plan and Chapter 16 Summary ( )"— Presentation transcript:

1 Completing the Physical-Query-Plan and Chapter 16 Summary (16.7-16.8)
CS257 Spring 2009 Professor Tsau Lin Student: Suntorn Sae-Eung Donavon Norwood

2 Chapter 16: Query Compiler
16.7 Completing the Physical-Query-Plan Choosing a Selection Method Choosing a Join Method Pipelining Versus Materialization Pipelining Unary Operations Pipelining Binary Operations Notation for Physical Query Plan Ordering the Physical Operations 16.8 Summary of Chapter 16

3 16.7 Completing the Physical-Query-Plan
A query previously has been parsed and preprocessed (16.1) converted to logical query plans (16.3) Estimated the costs of operations (16.4) determined costs by cost-based plan selection (16.5) weighed costs of join operations

4 Completing the Physical-Query-Plan (continued)
Three issues related to turning the logical plan into a complete physical plan are: Selection of algorithm to do the operations of the query plan Decisions after intermediate results are materialized and pipelined Notation for physical-query-plan operators

5 16.7.1 Choosing a Selection Method
Choose algorithms for each selection operators e.g. use Indexes or table scan? If so, how many indexed are used Filter or not?

6 Example of Selection Method

7 Choosing a Join Method Determine costs associated with each join algorithms One-pass join Sort-join

8 16.7.3 Pipelining Versus Materialization
Materialization (naïve way) – order the operations appropriately, and store the result of each operations on disk until it is needed by another operations Pipelining (more efficient way) – Interleave the execution of several operations, the tuples produced by one operation are passed directly to the operations the used it, without ever storing the intermediate tuples on disk.

9 16.7.4 Pipelining Unary Operations
Unary = selection and projection Best candidates for pipelining Pipelining Unary Operations are implemented by iterators (15.1.6)

10 16.7.5 Pipelining Binary Operations
The results of binary operations can also be pipelined. See the example for more understanding

11 Pipelining Binary Operations (continued)
Example 16.36

12 16.7.6 Notation for Physical Query Plans
There are various operators are found in physical query plan. Operator for leaves Physical Operators for Selection Physical Sorts Operators Other Relational-Algebra Operations However, each DBMS will use its own internal notation for physical query plan.

13 16.7.7 Ordering of Physical Operations
The physical query plan is represented as a tree, which implies about order of operations. Three rules summarize the ordering of events implicit in a physical-query-plan tree:

14 Ordering of Physical Operations (continued)
Break the tree into subtrees at each edge that represents materialization. The subtrees will be executed one-at-a-time. Order the execution of the subtrees in a bottom-up, left-to-right manner. Execute all nodes of each subtree using a network of iterators. Thus, all the nodes in one subtree are executed simultaneously.

15 16.8 Summary of Chapter 16 Compilation of Queries The parser
View expansion Semantic Checking Conversion to a Logical Query Plan Algebraic Transformations Choosing a Logical Query Plan

16 Summary of Chapter 16 (continued)
Estimating Sizes of Relations Histograms Cost-Based Optimization Plan-Enumeration Strategies Left-Deep Join Trees Physical Plans for Selection Pipelining Versus Materialization

17 Questions & Answers

18 For your attention

19 Reference [1] H. Garcia-Molina, J. Ullman, and J. Widom, “Database System: The Complete Book,” second edition: p , Prentice Hall, New Jersy, 2008


Download ppt "Completing the Physical-Query-Plan and Chapter 16 Summary ( )"

Similar presentations


Ads by Google