3. Waar zijn we? indexing II and higher-dimensional structures Les Nr. wie wat 1 ED intro, ER 2 ED EER 3 ED relational model 4 ED mapping EER2relational 5 KV relational algebra, relational calculus 6 KV SQL 7 KV vervolg SQL 8 KV demo Access, QBE, JDBC 9 KV functional dependencies and normalisation 10 KV functional dependencies and normalisation 11 BB file structures and hashing 12 BB indexing I 13 BB 14 BB query processing 15 BB transactions 16 BB query security 17 BB Data warehousing and mining 18 ED XML, oodb, multimedia db Fysisch model / vragen
4.
5. B. Wat helpt daarbij? join emp.SSN = project.leaderSSN emp σ emp.income > 1000000 project π emp.empname, project.projectname
6. C. Waar moeten we op letten? blokkentransport ! join emp.SSN = project.leaderSSN emp σ emp.income > 1000000 project π emp.empname, project.projectname
7. Agenda Overzicht Implementatie van operaties uit relationele algebra Heuristische optimalisatie Systematische optimalisatie d.m.v. kostenschattingen Semantische query-optimalisatie
8. Agenda Overzicht Implementatie van operaties uit relationele algebra Heuristische optimalisatie Systematische optimalisatie d.m.v. kostenschattingen Semantische query-optimalisatie
9.
10.
11.
12. Agenda Overzicht Implementatie van operaties uit relationele algebra Heuristische optimalisatie Systematische optimalisatie d.m.v. kostenschattingen Semantische query-optimalisatie
13.
14. Voorbeeld van conversie SELECT Lname, Fname FROM EMPLOYEE WHERE Salary >( SELECT MAX(Salary) FROM EMPLOYEE WHERE Dno = 5 ); c := F MAX Salary ( Dno = 5 (EMPLOYEE)) Lname, Fname ( Salary > c (EMPLOYEE))
15.
16.
17.
18. a e c i o x y u n p e h b q t z i d f n s k x i p w j q n e r h c p k c h k p r e j n p q w f i k n s x b d i q t z e h n p u y a c e i o x a b c d e e h i i n o p q t u x y z c e f h i j k k n n p p q r s w x a b c c d e e e f h i i i j ... splits sorteer meng meng buffer (tijdelijk) bestand r h c p k p w j q n e f n s k x i b q t z i d y u n p e h a e c i o x
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35. EMPLOYEE RESULTAAT DEPARTMENT EMPLOYEE in buitenste lus : Elk blok wordt 1 x gelezen: 2 000 DEPARTMENT in binnenste lus: elk blok wordt telkens opnieuw gelezen bij volgende uitvoering van buitenste lus: 400 x 10 = 4 000 Totaal gelezen blokken: 6 000 b D = 10 b E = 2000
36. DEPARTMENT RESULTAAT EMPLOYEE DEPARTMENT in buitenste lus: elk blok wordt 1 x gelezen: 10 EMPLOYEE in binnenste lus: elk blok wordt telkens opnieuw gelezen bij volgende uitvoering van buitenste lus: 2 x 2 000 = 4 000 Totaal gelezen blokken: 4 010 b D = 10 b E = 2000
37. EMPLOYEE RESULTAAT DEPARTMENT EMPLOYEE in buitenste lus : elk blok wordt 1 x gelezen: 2 000 DEPARTMENT in binnenste lus: elk blok wordt telkens opnieuw gelezen bij volgende uitvoering van buitenste lus: 2 000 x 10 = 20 000 Totaal gelezen blokken: 22 000 b D = 10 b E = 2000 Ter vergelijking: slechts 1 buffer reserveren voor buitenste lus :
38. DEPARTMENT RESULTAAT EMPLOYEE DEPARTMENT in buitenste lus: elk blok wordt 1 x gelezen: 10 EMPLOYEE in binnenste lus: elk blok wordt telkens opnieuw gelezen bij volgende uitvoering van buitenste lus: 10 x 2 000 = 20 000 Totaal gelezen blokken: 20 010 b D = 10 b E = 2000
39.
40.
41.
42.
43.
44.
45. R S 1 3 2 4 1 4 3 2 alle records r van R met h(r.A)=4 alle records s van S met h(s.B)=4 hash hash 1 4 3 2
71. SELECT Fname, Lname, Address FROM EMPLOYEE, DEPARTMENT WHERE Dname = ‘Research’ AND Dnumber = DNO ; Voorbeeld van uitvoeringsplan voor query Q1: Gebruik index voor selectie op DEPARTEMENT (als die bestaat) Gebruik geneste lussen voor join, (maar buitenste lus slechts 1-maal!) doorloop daarbij volledig EMPLOYEE bestand Doorloop resultaat van join voor projectie
72. Agenda Overzicht Implementatie van operaties uit relationele algebra Heuristische optimalisatie Systematische optimalisatie d.m.v. kostenschattingen Semantische query-optimalisatie
73.
74. Agenda Overzicht Implementatie van operaties uit relationele algebra Heuristische optimalisatie Systematische optimalisatie d.m.v. kostenschattingen Semantische query-optimalisatie
75.
76. Vooruitblijk Overzicht Implementatie van operaties uit relationele algebra Heuristische optimalisatie Systematische optimalisatie d.m.v. kostenschattingen Semantische query-optimalisatie Transactieverwerking