# 7queryevaluation -suppl_v01.pdf - Query Evaluation...

• No School
• AA 1
• 16

This preview shows page 1 - 8 out of 16 pages.

Query Evaluation Supplemental slides.
Execution Plan Skater Selection ࠵? ( age < 10) Participates Join R1.sid = P.sid R1 Project ࠵? (cid, rating) R2 Grouping on cid R3 Selection avg(rating) > 5 Index Nested Loop Sort Scan R4 Count and average R5 Scan Scan Scan SELECT P.cid, count(*), AVG(S.rating) FROM Skaters S, Participates P WHERE P.sid = S.sid AND S.age < 10 GROUP BY P.cid HAVING AVG(S.rating) > 5
Example Relations Skaters sid cid rank 31 101 2 58 103 7 58 101 7 58 104 1 28 104 2 31 101 3 50 104 3 52 101 4 53 104 4 53 103 5 52 101 6 sid sname rating age 28 Guppy 9 15 31 Debby 7 9 22 Conny 5 9 58 Lilly 10 8 45 Joe 8 7 50 Billy 5 7 52 Beth 6 6 53 Sally 4 7 Participates
Selection ࠵? ( age < 10) Scan sid sname rating age 31 Debby 7 9 22 Conny 5 9 58 Lilly 10 8 45 Joe 8 7 50 Billy 5 7 52 Beth 6 6 53 Sally 4 7 R1 Output is Pipelined (i.e., each qualified input record is send to output immediately)
Join R1.sid = P.sid Index Nested Loop sid sname rating age sid cid rank 31 Debby 7 9 31 101 2 58 Lilly 10 8 58 103 7 58 Lilly 10 8 58 101 7 58 Lilly 10 8 58 104 1 31 Debby 7 9 31 101 3 50 Billy 5 7 50 104 3 52 Beth 6 6 52 101 4 53 Sally 4 7 53 104 4 53 Sally 4 7 53 103 5 52 Beth 6 6 52 101 6 R2 Output can be Pipelined (i.e., each qualified input record can be send to output immediately)
Project ࠵? (cid, rating) Scan Output is Pipelined (i.e., each qualified input record is send to output immediately) rating cid 7 101 10 103 10 101 10 104 7 101 5 104 6 101 4 104 4 103 6 101 R3
Grouping on cid Sort Last step of sorting can be pipelined in some cases (more in future lectures) But this usually means That this operation does not output Records immediately.

#### You've reached the end of your free preview.

Want to read all 16 pages?

• Fall '19

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern