






























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!































parse
Query rewriting
Physical plan generation
execute result
SQL query
parse tree
statistics logical query plan
physical query plan
2; 16.
3; 16.2,16.
1; 13, 15
4; 16.4—16.
Pick the best plan from the space of physical plans
The Space of Physical Plans is Very Large
Approaches for Query Optimization
Why do we need Query Rewriting?
Reduces optimization time drastically without noticeably affecting quality
R.A = “c”
R.C = S.C
D
Select B,D From R,S Where R.A = “c” ∧ R.C=S.C
πB,D
σR.A = “c” Λ R.C = S.C
X
R S
πB,D
σR.A = “c”
X R S
σR.C = S.C
πB,D
σR.A = “c”
σR.C = S.C
πB,D
σR.A = “c”
X
R S
σR.C = S.C
R S = S R Commutativity
(R S) T = R (S T) Associativity
Also holds for: Cross Products, Union, Intersection R x S = S x R (R x S) x T = R x (S x T) R U S = S U R R U (S U T) = (R U S) U T
Let: X = set of attributes Y = set of attributes XY = X U Y