Professional Documents
Culture Documents
Introduction
Transformation of Relational Expressions
Cost-based optimization
Equivalence Expressions
Statistical Information for Cost Estimation
Database System Concepts - 7th Edition 16.2 ©Silberschatz, Korth and Sudarshan
Introduction
Database System Concepts - 7th Edition 16.3 ©Silberschatz, Korth and Sudarshan
Introduction (Cont.)
Database System Concepts - 7th Edition 16.4 ©Silberschatz, Korth and Sudarshan
Equivalence of Expressions
Database System Concepts - 7th Edition 16.6 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.7 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.8 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.9 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.10 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.11 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.12 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.13 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.14 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.15 ©Silberschatz, Korth and Sudarshan
Database System Concepts - 7th Edition 16.16 ©Silberschatz, Korth and Sudarshan
Semi Join
Database System Concepts - 7th Edition 16.17 ©Silberschatz, Korth and Sudarshan
Semi Join - Example
Database System Concepts - 7th Edition 16.18 ©Silberschatz, Korth and Sudarshan
Equivalence Rules ( 16 Rules ..)
where L1 ⊆ L2 … ⊆ Ln
a. σ (E1 x E2) ≡ E1 ⨝ E2
Database System Concepts - 7th Edition 16.19 ©Silberschatz, Korth and Sudarshan
Equivalence Rules (Cont.)
E1 ⨝ E2 ≡ E2 ⨝ E1
Database System Concepts - 7th Edition 16.20 ©Silberschatz, Korth and Sudarshan
Pictorial Depiction of Equivalence Rules
Database System Concepts - 7th Edition 16.21 ©Silberschatz, Korth and Sudarshan
Equivalence Rules (Cont.)
Database System Concepts - 7th Edition 16.23 ©Silberschatz, Korth and Sudarshan
Equivalence Rules (Cont.)
Database System Concepts - 7th Edition 16.24 ©Silberschatz, Korth and Sudarshan
Equivalence Rules (Cont.)
13. Selection distributes over aggregation as below
(G𝛾A(E)) ≡ G𝛾A((E))
provided only involves attributes in G
14. a. Full outerjoin is commutative:
E1 ⟗ E2 ≡ E2 ⟗ E1
b. Left and right outerjoin are not commutative, but:
E1 ⟕ E2 ≡ E2 ⟖ E1
15. Selection distributes over left and right outerjoins as below,
provided 1
only involves attributes of E1
a. 1 (E1 ⟕ E2) ≡ (1 (E1)) ⟕ E2
b. 1 (E1 ⟖ E2) ≡ E2 ⟕ (1 (E1))
16. Outerjoins can be replaced by inner joins under some
conditions
a. 1 (E1 ⟕ E2) ≡ 1 (E1 ⨝ E2)
b. 1 (E1 ⟖ E1) ≡ 1 (E1 ⨝ E2)
provided 1 is null rejecting on E2
Database System Concepts - 7th Edition 16.25 ©Silberschatz, Korth and Sudarshan
Transformation Example: Pushing
Selections
Database System Concepts - 7th Edition 16.26 ©Silberschatz, Korth and Sudarshan
Multiple Transformations (Cont.)
Database System Concepts - 7th Edition 16.27 ©Silberschatz, Korth and Sudarshan
Join Ordering Example
(r 1 ⨝ r 2 ) ⨝ r 3 = r 1 ⨝ (r 2 ⨝ r 3 )
(Join Associativity) ⨝
(r 1 ⨝ r 2 ) ⨝ r 3
Database System Concepts - 7th Edition 16.28 ©Silberschatz, Korth and Sudarshan
Join Ordering Example (Cont.)
Database System Concepts - 7th Edition 16.29 ©Silberschatz, Korth and Sudarshan
Cost Estimation
Database System Concepts - 7th Edition 16.30 ©Silberschatz, Korth and Sudarshan
Statistical Information for Cost
Estimation
Database System Concepts - 7th Edition 16.31 ©Silberschatz, Korth and Sudarshan
Join Operation: Running Example
Running example:
student ⨝ takes
nstudent = 5,000.
ntakes = 10000.
Database System Concepts - 7th Edition 16.33 ©Silberschatz, Korth and Sudarshan
Estimation of the Size of Joins (Cont.)
Database System Concepts - 7th Edition 16.34 ©Silberschatz, Korth and Sudarshan
Estimation of the Size of Joins (Cont.)
Database System Concepts - 7th Edition 16.35 ©Silberschatz, Korth and Sudarshan