1 / 23

Initial QGM

Initial QGM. Q1.CDept=‘mgmt’ And Q1.Grade>=Q2.$1. SELECT Q1.SName FROM took Q1, temp1 Q2 WHERE Q1.CDept = ‘mgmt’ AND Q1.Grade >= Q2.$1. Q2. Q1. Grade. SName, CName, CDept, Grade. temp1. Q4. SELECT Max(Grade) AS Grade FROM Child Q4. Max. Grade. took.

stevie
Download Presentation

Initial QGM

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Initial QGM

  2. Q1.CDept=‘mgmt’ AndQ1.Grade>=Q2.$1 SELECT Q1.SName FROM took Q1, temp1 Q2 WHERE Q1.CDept = ‘mgmt’ AND Q1.Grade >= Q2.$1 Q2 Q1 Grade SName, CName, CDept, Grade temp1 Q4 SELECT Max(Grade) AS Grade FROM Child Q4 Max Grade took SELECT Grade FROM took Q3 WHERE Q3.CName=Q1.CName Q3 CName, Grade took

  3. Performing Feed for the topmost Box

  4. Q1.Grade>=Q2.$1 SELECT Q1.SName FROM took Q1, temp1 Q2 WHERE Q1.Grade >= Q2.$1 supp Q2 Q1 Grade SName, CName, Grade temp1 SELECT MAX (Grade) AS Grade FROM Child Q4 Max CDept=‘mgmt’ SELECT DISTINCT CName FROM supp distinct SName, CName, CDept, Grade Magic_1 took

  5. Q1.Grade>=Q2.$1 SELECT Q1.SName FROM took Q1, CIBox Q2 WHERE Q1.Grade >= Q2.$1 supp Q2 Q1 SName, CName, Grade SELECT Q3.Grade FROM DCOBox Q3 WHERE Q3.CName = Q1.CName Q3 Q3.CName=Q1.CName CIBox CName CName CName,Grade CDept=‘mgmt’ distinct Q4 Q5 SELECT Q4.cName, Q5.$1FROM Magic_1 Q4, temp1 Q5 SName, CName, CDept, Grade DCOBox Grade Magic_1 Q6 temp1 took Max

  6. Can merge the C1Box and the topmost box into one box as every tuple in the topmost box joins with atmost one tuple in the C1Box

  7. Q1.Grade>=Q2.Grade Q1.cName=Q2.cName SELECT Q1.sName FROM supp Q1, DCOBox Q2WHERE Q1.cName=Q2.cName AND Q1.Grade>=Q2.Grade supp Q2 Q1 SName, CName, Grade CName,Grade CName CName CDept=‘mgmt’ SELECT Q4.cName,Q5.$1FROM Magic_1 Q4, temp1 Q5 distinct Q4 Q5 SName, CName, CDept, Grade DCOBox Grade Magic_1 Q6 temp1 took Max

  8. Starting Point for the Aggregation Box

  9. CName, Grade Q4 Q5 SELECT Q4.CName, Q5.$1 AS Grade FROM Magic_1 Q4, temp1 Q5 DCOBox Grade CName temp1 SELECT Max(Grade) AS Grade FROM Child Q6 Q6 Max distinct Grade Magic_1 Q4.CName=Q3.CName Q3 SELECT Grade FROM took Q3 WHERE Q3.CName=Q1.CName CName, Grade took

  10. Performing Feed for the aggregate Box

  11. CName, Grade SELECT Q4.CName,Q5.$1 From Magic_1 Q4, temp1 Q5 Q4 Q5 DCOBox Grade CName SELECT Max(Grade) AS Grade FROM Child Q6 Q6 temp1 Max Grade SELECT Grade FROM DCOBox Q7 WHERE Q7.CName = Q4.CName distinct Q7.cName=Q4.cName Q7 CIBox CName CName, Grade Magic_1 Q8 Q9 SELECT Q8.CName, Q9.Grade FROM Magic_2 Q8, Child Q9 DCOBox Grade SELECT Grade FROM took Q3 WHERE Q3.CName = Q1.CName CName Q1.CName=Q3.CName Q3 distinct CName, Grade Magic_2 took

  12. Performing Absorb for the aggregate Box – introduce the Group By and the LOJ

  13. CName, Grade Q4 Q5 DCOBox SELECT Q4.CName, Q5.Grade FROM Magic_1 Q4 LOJ temp1 Q5 ON CName CName, Grade CName SELECT CName, MAX (Grade) AS GradeFROM Child Q6GROUPBY Q6.CName Max Q6 temp1 CName, Grade distinct Q7 CIBox CName CName, Grade Magic_1 Q8 Q9 DCOBox Grade CName Q1.cName=Q3.cName Q3 distinct CName, Grade Magic_2 took

  14. The LOJ is unnecessary here, and the C1Box is also unnecessary.

  15. Q1.Grade>=Q2.Grade Q1.CName=Q2.CName SELECT Q1.SName FROM supp Q1, temp1 Q2 WHERE Q1.CName = Q2.CName AND Q1.Grade >= Q2.Grade Q2 Q1 CName, Grade SELECT CName, MAX (Grade) AS GradeFROM Child Q6GROUPBY Q6.CName Q6 temp1 Max CName, Grade Q8 Q9 DCOBox Grade CName Q1.CName=Q3.CName Q3 distinct CName, Grade Magic_2 took

  16. Starting Point for the bottommost SPJ Box

  17. CName, Grade SELECT Q8.CName, Q9.Grade FROM Magic_2 Q8, temp2 Q9 Q8 Q9 DCOBox Grade CName temp2 Q8.CName=Q3.CName Q3 SELECT Grade FROM took Q3 WHERE Q3.CName = Q1.CName distinct CName, Grade took Magic_2

  18. Performing Absorb for the SPJ Box

  19. CName, Grade SELECT Q9.CName, Q9.Grade FROM temp2 Q9 Q8 Q9 DCOBox CName, Grade CName temp2 Q10.CName=Q3.CName Q10 Q3 SELECT Q3.CName, Q3.Grade FROM Magic_2 Q10, took Q3 WHERE Q3.CName = Q10.CName distinct CName CName, Grade took Magic_2

  20. Remove unnecessary DCOBox

  21. CName, Grade SELECT Q3.CName, Q3.Grade FROM Magic_2 Q10, took Q3 WHERE Q3.CName = Q10.CName Q10.cName=Q3.cName Q10 Q3 distinct CName CName, Grade took Magic_2

  22. The Final QGM

  23. Q1.Grade>=Q2.Grade Q1.CName=Q2.CName SELECT Q1.sName FROM supp Q1, temp1 Q2WHERE Q1.CName=Q2.CName AND Q1.Grade>=Q2.Grade Q1 Q2 SName, CName, Grade CName, Grade temp1 SELECT CName, MAX (Grade) AS GradeFROM Child Q6GROUPBY Q6.CName Q6 Max CDept=‘mgmt’ CName, Grade SName, CName, CDept, Grade CName Q10.CName=Q3.CName Q10 Q3 SELECT Q3.CName, Q3.Grade FROM Magic_2 Q10, took Q3 WHERE Q3.CName = Q10.CName distinct took CName CName, Grade took Magic_2

More Related