Query Rewrite: Predicate Movearound
Create View V1 AS
Select rating, Min(age)
From Sailors S
Where S.age < 20
GroupBy rating
Create View V2 AS
Select sid, rating, age, date
From Sailors S, Reserves R
Where R.sid=S.sid, and
S.age < 20.
Select sid, date
From V1, V2
Where V1.rating = V2.rating and
V1.age = V2.age, and age < 20
Sailing wizz dates: when did the youngest of each sailor level rent boats?
First, move
predicates up the
tree.
Then, move them
down.
Previous slide
Next slide
Back to first slide
View graphic version