Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

Informationsintegration Verteilte Anfragebearbeitung

Ähnliche Präsentationen


Präsentation zum Thema: "Informationsintegration Verteilte Anfragebearbeitung"—  Präsentation transkript:

1 Informationsintegration Verteilte Anfragebearbeitung
Felix Naumann

2 Felix Naumann, VL Informationsintegration, WS 05/06
10,000 feet Einführung in die Informationsintegration Szenarien der Informationsintegration Verteilung und Autonomie Heterogenität Materialisierte und virtuelle Integration Klassifikation integrierter Informationssysteme und 5-Schichten Architektur Mediator/Wrapper-Architektur Global-as-View und Lokal-as-View Modellierung Global-as-View Anfragebearbeitung SchemaSQL Verteilte Anfragebearbeitung Dynamische Programmierung in verteilten Datenbanken Top-N Anfragen Problemstellung Architekturen Modellierung Optimierung Felix Naumann, VL Informationsintegration, WS 05/06

3 Felix Naumann, VL Informationsintegration, WS 05/06
10,000 feet Informationsqualität Duplikaterkennung ETL & Data Lineage Datenfusion - Union & Co. Containment & Local-as-View Anfragebearbeitung Bucket Algorithmus Peer-Data-Management Systeme (PDMS) Schema Mapping Schema Matching Hidden Web Semantic Web Forschungsprojekte  - TSIMMIS, Garlic, Revere, etc Data Streams Konflikte Anfragen Mapping Systeme Felix Naumann, VL Informationsintegration, WS 05/06

4 Felix Naumann, VL Informationsintegration, WS 05/06
Überblick Anfragebearbeitung im Überblick Techniken der Verteilten Anfragebearbeitung Row Blocking Multicasts Multithreading Partitionierung Joinbearbeitung Semi-Join Reduzierung Semi-Join mit Filter Felix Naumann, VL Informationsintegration, WS 05/06

5 Parallelität vs. Verteilung
Parallele DBMS Shared memory Shared disk Shared nothing Fokus auf Transaktionen und Anfragebearbeitung Verteilte DBMS Fokus auf Heterogenität und Anfragebearbeitung Unser Fokus! Felix Naumann, VL Informationsintegration, WS 05/06

6 Architektur zur zentralen Anfragebearbeitung
Logische Optimierung (unabhängig von System und Konfiguration): Entschachtelung, redundante Prädikate,... Wandelt Plan (Baum) in ausführbaren Plan (Code) um. Anfrage- ergebnis Anfrage Parser Anfrage- umschreibung Anfrage- optimierung Code Generierung Anfragebearbeitung (Engine) Katalog/ Metadaten Optimierung für System und Konfiguration: Indices, Joinreihenfolge, Selektion der Datenquelle Daten Syntax und etwas Semantik Erzeugt Anfragegraph Schema, Statistik, Partitionierung, Lage der Daten,... Felix Naumann, VL Informationsintegration, WS 05/06

7 Anfragebearbeitung in verteilten Systemen
Anfragen sind deklarativ. Anfragen müssen in ausführbare (prozedurale) Form transformiert werden. Ziele QEP – prozeduraler Query Execution Plan Effizienz Schnell Wenig Ressourcenverbrauch (CPU, I/O, RAM, Bandbreite) Felix Naumann, VL Informationsintegration, WS 05/06

8 Schritt 1: Anfragetransformation
Parsen der Anfrage (Syntax) Namensauflösung Überprüfen der Elemente (Semantik) Normalisierung Konjunktive Normalform in WHERE Klausel Algebraische Vereinfachung Eliminierung redundanter Teilausdrücke Transformation zum Operatorbaum Felix Naumann, VL Informationsintegration, WS 05/06

9 Schritt 2: Daten-Lokalisierung
Globale Relationen werden abgebildet auf lokale Relationen GaV / LaV Algebraische Vereinfachungen Felix Naumann, VL Informationsintegration, WS 05/06

10 Schritt 3: Globale Optimierung
Bestimmung eines Ausführungsplanes mit minimalen globalen Kosten Bestimmung der Ausführungsknoten Festlegung der Ausführungsreihenfolge (sequentiell, parallel) Alternative Strategien zur Join-Berechnung bewerten (z.B. mit Semi-Join) Aber: Trennung zwischen globaler und lokaler Optimierung kann zur Auswahl suboptimaler Pläne führen Kostenmodell |Instruktionen| + |Diskzugriffe| + |Nachrichten| + |übertragene Byte| Kosten = (TCPU * #insts) + (TI/O * #I/Os) + (TMSG * #msgs) + (TTR * #byte) Felix Naumann, VL Informationsintegration, WS 05/06

11 Neue Ziele der Anfragebearbeitung
Site 0 In zentralisierten (mehr-Benutzer) DBMS Durchsatz (throughput) = Anzahl der verarbeiteten Tupel Minimierung des Ressourcenverbrauchs In verteilten DBMS Gesamt-Ressourcenverbrauch erhöhen um schnellere Antworten zu erhalten Minimierung der Antwortzeit R S T U Site 0 receive receive Site 1 Site 2 send send R S T U Felix Naumann, VL Informationsintegration, WS 05/06

12 Dimensionen der Anfragebearbeitung
Festlegung des Ausführungsknotens Festlegung der Auswertungsstrategie Ship whole Vollständige Relationen Wenig Nachrichten Viele Byte Fetch rows as needed Bindings Viele Nachrichten Nur relevante Byte Semi Join Fetch columns as needed Semi-Join Site 0 receive receive Site 1 Site 2 send send R S T U Felix Naumann, VL Informationsintegration, WS 05/06

13 Schritt 4: Lokale Optimierung
Entsprechend des jeweiligen Systems Lokale Katalogdaten Lokale Parameter TCPU und TI/O Etc. Felix Naumann, VL Informationsintegration, WS 05/06

14 Felix Naumann, VL Informationsintegration, WS 05/06
Überblick Anfragebearbeitung im Überblick Techniken der Verteilten Anfragebearbeitung Row Blocking Multicasts Multithreading Partitionierung Joinbearbeitung Semi-Join Reduzierung Semi-Join mit Filter Felix Naumann, VL Informationsintegration, WS 05/06

15 Felix Naumann, VL Informationsintegration, WS 05/06
Row Blocking Anfragebearbeitung in verteilten DBMS mittels send und receive Operatoren Naiv: Für jedes Tupel eine send und eine receive Operation Besser: Row blocking Tupel werden gesammelt und en block versendet. Blockgröße abhängig von datagram-Größe im Netzwerk (z.B. 64kB) Queues puffern unregelmäßige Pipelines Wichtig in Netzwerken; Stillstand wird vermieden. Felix Naumann, VL Informationsintegration, WS 05/06

16 Row Blocking ⋈ receive receive send send ⋈ ⋈ Site 0 Site 1 Site 2 R S
Erlaubt konstante(re) Ausführung des restlichen Plans Puffer Puffer receive receive Netzwerkun-regelmäßigkeiten Site 1 Site 2 send send Row blocking Puffer Puffer R S T U Felix Naumann, VL Informationsintegration, WS 05/06

17 Felix Naumann, VL Informationsintegration, WS 05/06
Multicasts Site 0 Site 0 receive receive receive receive T T Site 2 Site 2 send send send Optimierung receive receive S S Site 1 Site 1 send send R R Felix Naumann, VL Informationsintegration, WS 05/06

18 Felix Naumann, VL Informationsintegration, WS 05/06
Multicasts Site 0 Einsparungen Netzverkehr CPU (packing und unpacking) Optimierung Viele Alternativen Physisch: Welche Daten schicke ich wohin? Welchen Operator führe ich wo aus? Logisch: Outer joins statt inner joins Späte/Frühe Projektion Usw. Kostenmodell Dynamische Entscheidungen noch während der Ausführung! receive receive T Site 2 send send receive S Site 1 send R Felix Naumann, VL Informationsintegration, WS 05/06

19 Felix Naumann, VL Informationsintegration, WS 05/06
Multi-Threading Single-threaded UNION: Sukzessive ein Datagram von einer Site „Round-robin“-Verfahren Multi-threaded UNION: Parallele Verarbeitung der send und receive Operationen Vorteile Netzwerkverkehr parallel Send Operationen parallel Nachteile Zusätzliche Kosten durch Synchronisation (shared memory) Zusätzliche Kosten durch Konkurrenz um Ressourcen Optimierer muss entscheiden welche Operatoren in wie vielen Threads ausgeführt wird. Site 0 receive receive receive Site 1 Site 2 Site 3 send send send R R R Felix Naumann, VL Informationsintegration, WS 05/06

20 Felix Naumann, VL Informationsintegration, WS 05/06
Multi-Threading Multi-threading nicht immer vorteilhaft z.B. Speicherplatz Site 0 Sort-merge-join sort sort receive receive Site 1 Site 3 send send R S Felix Naumann, VL Informationsintegration, WS 05/06

21 Felix Naumann, VL Informationsintegration, WS 05/06
Partitionierung Grundlagen von DBMS Vertikal Verschiedene Projektionen einer Relation Jedes Attribut in mindestens einer Partition Erhalt eines Schlüssels! Auch: Normalisierung Horizontal Verschiedene (disjunkte) Selektionen einer Relation Beispiel Partition A: SELECT * FROM R WHERE area=`Nord´ Partition B: SELECT * FROM R WHERE area=`Süd´ (bzw.  `Nord´) Jedes Tupel in mindestens einer Partition Optimierung Wie partitionieren? Wie die Partitionen verteilen? Abhängig von Anwendungen und query workload Felix Naumann, VL Informationsintegration, WS 05/06

22 Joins über horizontale Partitionen
Sei R horizontal partitioniert R = R1 ∪ R2 Alternativen R ⋈ S = (R1 ∪ R2) ⋈ S R ⋈ S = (R1 ⋈ S) ∪ (R2⋈ S) Komplikationen R noch weiter partitioniert S ebenfalls partitioniert Unterschiedliche Kosten Wer führt was wo aus? Felix Naumann, VL Informationsintegration, WS 05/06

23 Selektion über horizontale Partitionierung
Beispiel: Mitschang, VL „Verteilte DBMS“ Felix Naumann, VL Informationsintegration, WS 05/06

24 Join über horizontale Partitionierung
Beispiel: Mitschang, VL „Verteilte DBMS“ Felix Naumann, VL Informationsintegration, WS 05/06

25 Joins über horizontale Partitionen
Frage: Wieviel wird jeweils übertragen? |(R1 ⋃ R2) ⋈S| |R3 ⋈S| Site 0 Site 0 |R| Optimierung receive receive receive receive Site 1 Site 1 |S| send send |R3| Site 2 send Site 2 receive send send R1 R2 S R3 S R1 R2 S R3 S Felix Naumann, VL Informationsintegration, WS 05/06

26 Joins über horizontale Partitionen
Optimierung Lage der Partitionen Kostenvergleiche Leere Teilergebnisse (Ri ⋈ Sj = ) Vorhersagen & Vermeiden Häufig: Zwei Relationen nach gleichem Prädikat partitioniert „Abteilungen“ nach Standort partitioniert (Nord, Süd) „Mitarbeiter“ nach Abteilung (also auch nach Standort) partitioniert Dann: R ⋈ S = (R1⋈S1) ∪ (R1⋈S2) ∪ (R2⋈S1) ∪ (R2⋈S2) = (R1⋈S1) ∪ (R2⋈S2) D. h. Joins (Ri ⋈ Sj) nur ausführen falls i = j Felix Naumann, VL Informationsintegration, WS 05/06

27 Felix Naumann, VL Informationsintegration, WS 05/06
Überblick Anfragebearbeitung im Überblick Techniken der Verteilten Anfragebearbeitung Row Blocking Multicasts Multithreading Partitionierung Joinbearbeitung Semi-Join Reduzierung Semi-Join mit Filter Felix Naumann, VL Informationsintegration, WS 05/06

28 Semi-Join ⋈ ⋈ receive receive send send
Ergebnis (ohne Attribute von S) in Site 1 verlangt Site 1 Site 1 receive R receive R Site 0 Site 0 send |S| x ID-length(S) send |S| x tuple-length(S) ID S S Felix Naumann, VL Informationsintegration, WS 05/06

29 Semi-Join ⋈ ⋈ receive receive send ⋊ send send receive
Ergebnis (mit Attributen von S) in Site 1 verlangt Merge-join |R ⋈ S| x tuple-length (S) Site 1 Site 1 Site 0 receive R receive send Site 0 send |S| x tuple-length(S) send receive S ID S R |R| x ID-length(R) Felix Naumann, VL Informationsintegration, WS 05/06

30 Felix Naumann, VL Informationsintegration, WS 05/06
Semi-Join Formal R(A), S(B) R ⋉ S := A(R⋈FS) = A(R) ⋈F AB(S) = R⋈F AB(S) i.d.R. = R⋈F F(S) Nicht symmetrisch! Literatur: [BC81] in jedem DB Lehrbuch Felix Naumann, VL Informationsintegration, WS 05/06

31 Semi-Join ⋈ receive receive send send ⋈ receive receive ⋉ send receive
Site 1 |R ⋈ S| x tl(S) |R ⋈ S| x tl(R) receive receive Ergebnis (Attribute aus S und R) in Site 1 verlangt |R ⋈ S| x ID-length (R) Site 0 Site 2 Site 1 send send receive receive send receive Site 2 Site 0 ID |R| x tl(R) send send send |S| x tl(S) R ID S receive R S Frage: Welche 2 anderen Strategien sind möglich? Frage: Welche anderen Strategien sind möglich? |S| x ID-length(S) Felix Naumann, VL Informationsintegration, WS 05/06

32 Optimierung mit Semi-Join
Transformationsregeln für Joins R⋈FS = (R ⋉F S) ⋈F S R verkleinern, dann Join mit S R⋈F (S ⋉F R) S verkleinern, dann Join mit R (R ⋉F S) ⋈F (S ⋉F R) R und S verkleinern dann Join. Problem: Wann welche Variante einsetzen? Frage: Welche beiden Varianten standen auf der vorigen Folie? Felix Naumann, VL Informationsintegration, WS 05/06

33 Optimierung mit Semi-Join
Kostenmodell |Instruktionen| + |Diskzugriffe| + |Nachrichten| + |übertragene Byte| Kosten = TCPU * #insts + TI/O * #I/Os TMSG * #msgs TTR * #byte Hier nur: |übertragene Byte| Kostenvergleich (Annahme: |R| < |S|) K(R⋈FS) = byte(R) K((R ⋉F S) ⋈F S) = byte(F(S)) + byte((R ⋈F S)) Felix Naumann, VL Informationsintegration, WS 05/06

34 Eine Übung im letzten Jahr: Die Daten
Zwei Datenbanken in DB2 FilmDB1 Schema: Movie1 Tabelle: Movie1.Filme1(Titel Character(100), Jahr Integer) FilmDB2 Schema: Movie2 Tabelle: Movie2.Filme2(Titel Character(100), Regie Character(50)) Zugriffsberechtigungen: Lesend auf die Tabellen CREATE TABLE auf die Datenbanken INSERT auf neue Tabellen Felix Naumann, VL Informationsintegration, WS 05/06

35 Eine Übung im letzten Jahr: Die Aufgabe
Titel und Regisseur aller Filme, die jünger als 1980 sind. SELECT F1.Titel, F2.Regie FROM Movie1.Filme1 F1, Movie2.Filme2 F2 WHERE F1.Titel = F2.Titel AND F1.Jahr > 1980 Zur Kontrolle: Ergebniskardinalität ist 1121. Problem: Join über verschiedene Datenbanken Passing Binding Semijoins Andere? Felix Naumann, VL Informationsintegration, WS 05/06

36 Eine Übung im letzten Jahr: Auswertung
Naive Lösung (vorgegeben): Kosten = Byte Byte Noch naiver: Große Tabelle außen. Gruppe Felix Naumann, VL Informationsintegration, WS 05/06

37 Eine Übung im letzten Jahr: Die gesammelten Tricks
Prepared Statement Rtrim() Filme2 ist wesentlich kleiner Gezielte Projektionen Jahr muss nie übertragen werden Jeder Titel höchstens einmal Hashfunktionen als UDF In SPJ Anfrage Auf Kollisionen getestet Optimiert auf Länge Rollback statt drop table  Felix Naumann, VL Informationsintegration, WS 05/06

38 Felix Naumann, VL Informationsintegration, WS 05/06
Chipmunks CREATE TABLE firma06 (h INTEGER NOT NULL PRIMARY KEY) alle "hash" Werte für titel aus Firma2 holen SELECT DISTINCT ASCII(titel)* LENGTH(RTRIM(titel))* (ASCII(substr(rtrim(titel),length(rtrim(titel)))))* (ASCII(SUBSTR(RTRIM(titel),(LENGTH(RTRIM(titel))/2)+1,1)))* (ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))* ,0))+1,1)))* (ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))* ,0))+1,1)))* (ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))* ,0))+1,1)))* (ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))* ,0))+1,1)))* (ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))* ,0))+1,1)))* (ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))* ,0))+1,1)))* (ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))* ,0))+1,1)))* (ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))* ,0))+1,1)))* FROM movie2.filme2 Felix Naumann, VL Informationsintegration, WS 05/06

39 Eine Übung im letzten Jahr: Auswertung
camarilla bib gruppe1 IFA blub 10099 Die Drei ii Projekt Chaos 0815 Hedge Knights fmr idefix Chipmunks Ghost Dogs Felix Naumann, VL Informationsintegration, WS 05/06

40 Felix Naumann, VL Informationsintegration, WS 05/06
Überblick Anfragebearbeitung im Überblick Techniken der Verteilten Anfragebearbeitung Row Blocking Multicasts Multithreading Partitionierung Joinbearbeitung Semi-Join Reduzierung Semi-Join mit Filter Felix Naumann, VL Informationsintegration, WS 05/06

41 Optimierung mit Semi-Join
Komplexeres Beispiel R ⋈FS ⋈G T = (R ⋉F S) ⋈F (S ⋉G T) ⋈G T = (R ⋉F (S ⋉G T)) ⋈F (S ⋉G T) ⋈G T Allgemein: Man suche für jede Relation das beste Semi-Join Programm, den vollständigen Reduzierer („full reducer“). Eine fully reduced Relation enthält keine Tupel, die nicht zur Anfragebearbeitung benötigt werden. Für jede Relation in einer Anfrage existieren exponentiell viele Semi-Join Programme. Zyklische Anfragen: i.A. existiert kein full reducer. Baum-Anfragen: Finden des full reducer NP-schwer. Ketten-Anfragen: Finden des full reducer polynomial. Felix Naumann, VL Informationsintegration, WS 05/06

42 Optimierung mit Semi-Join
Ketten-Anfragen SELECT EMP.name, DEPT.name FROM EMP, DEPT, PROJ WHERE EMP.d_ID = DEPT.ID AND EMP.p_ID = PROJ.ID Mitarbeiter mit ihren Abteilungen, die an einem Projekt arbeiten. PROJECTS EMPLOYEES DEPARTMENTS Ermittlung der full reducer für jede Relation in 2 Phasen Vorwärts Rückwärts Felix Naumann, VL Informationsintegration, WS 05/06

43 Felix Naumann, VL Informationsintegration, WS 05/06
Fully Reduce Ermittlung der full reducer für jede Relation in 2 Phasen Vorwärts Rückwärts Allgemein für Kettenanfragen R1 ⋈A R2 ⋈B ... ⋈Y R(n-1) ⋈Z Rn R2‘ = R2 ⋉ R1 R3‘ = R3 ⋉ R2‘ = R3 ⋉ (R2 ⋉ R1) ... Rn‘ = Rn ⋉ R(n-1)‘ = ... R(n-1)‘‘ = R(n-1)‘ ⋉ Rn‘ R(n-2)‘‘ = R(n-2)‘ ⋉ R(n-1)‘ R1‘‘ = R1 ⋉ R2‘‘ Full reducer für Rn Full reducer für R(n-1) Full reducer für R1 Felix Naumann, VL Informationsintegration, WS 05/06

44 Felix Naumann, VL Informationsintegration, WS 05/06
Fully Reduce Beispiel für Kettenanfragen R1 ⋈A R2 ⋈B R3 ⋈C R4 Vorwärts R2‘ = R2 ⋉ R1 R3‘ = R3 ⋉ R2‘ [= R3 ⋉ (R2 ⋉ R1)] R4‘ = R4 ⋉ R3‘ [= R4 ⋉ (R3 ⋉ (R2 ⋉ R1))] Rückwärts R3‘‘ = R3‘ ⋉ R4‘ R2‘‘ = R2‘ ⋉ R3‘‘ R1‘‘ = R1 ⋉ R2‘‘ Felix Naumann, VL Informationsintegration, WS 05/06

45 Fully Reduce – Beispiel
Site 0 Site 1 Site 2 Site 3 A B C B C A R1 R2 R3 R4 Vorwärts R2‘ = R2 ⋉ R1 R3‘ = R3 ⋉ R2‘ R4‘ = R4 ⋉ R3‘ Rückwärts R3‘‘ = R3‘ ⋉ R4‘ R2‘‘ = R2‘ ⋉ R3‘‘ R1‘‘ = R1 ⋉ R2‘‘ Full reducer Felix Naumann, VL Informationsintegration, WS 05/06

46 Fully Reduce – Beispiel
Site 0 Site 1 Site 2 Site 3 X A 1 7 2 3 6 4 5 A B 9 3 5 7 2 B C 3 1 7 2 5 6 C Z 2 1 3 4 5 6 7 8 R1 R2 R3 R4 R1 ⋈A R2 ⋈B R3 ⋈C R4 Felix Naumann, VL Informationsintegration, WS 05/06

47 Fully Reduce – Beispiel
Site 0 Site 1 Site 2 Site 3 X A 1 7 2 3 6 4 5 A B 9 3 5 7 2 B C 3 1 7 2 5 6 C Z 2 1 3 4 5 6 7 8 (1,5,6,7) R1 R2 R3 R4 R1 ⋈A R2 ⋈B R3 ⋈C R4 Felix Naumann, VL Informationsintegration, WS 05/06

48 Fully Reduce – Beispiel
Site 0 Site 1 Site 2 Site 3 X A 1 7 2 3 6 4 5 A B 9 3 5 7 2 B C 3 1 7 2 5 6 C Z 2 1 3 4 5 6 7 8 (1,5,6,7) (3,5,7) R1 R2 R3 R4 R1 ⋈A R2 ⋈B R3 ⋈C R4 Felix Naumann, VL Informationsintegration, WS 05/06

49 Fully Reduce – Beispiel
Site 0 Site 1 Site 2 Site 3 X A 1 7 2 3 6 4 5 A B 9 3 5 7 2 B C 3 1 7 2 5 6 C Z 2 1 3 4 5 6 7 8 (1,5,6,7) (3,5,7) (1,2,3) R1 R2 R3 R4 R1 ⋈A R2 ⋈B R3 ⋈C R4 Felix Naumann, VL Informationsintegration, WS 05/06

50 Fully Reduce – Beispiel
Site 0 Site 1 Site 2 Site 3 X A 1 7 2 3 6 4 5 A B 9 3 5 7 2 B C 3 1 7 2 5 6 C Z 2 1 3 4 5 6 7 8 (2,3) (1,5,6,7) (3,5,7) (1,2,3) R1 R2 R3 R4 R1 ⋈A R2 ⋈B R3 ⋈C R4 Felix Naumann, VL Informationsintegration, WS 05/06

51 Fully Reduce – Beispiel
Site 0 Site 1 Site 2 Site 3 X A 1 7 2 3 6 4 5 A B 9 3 5 7 2 B C 3 1 7 2 5 6 C Z 2 1 3 4 5 6 7 8 (5,7) (2,3) (1,5,6,7) (3,5,7) (1,2,3) R1 R2 R3 R4 R1 ⋈A R2 ⋈B R3 ⋈C R4 Felix Naumann, VL Informationsintegration, WS 05/06

52 Fully Reduce – Beispiel
Site 0 Site 1 Site 2 Site 3 X A 1 7 2 3 6 4 5 A B 9 3 5 7 2 B C 3 1 7 2 5 6 C Z 2 1 3 4 5 6 7 8 (5,7) (5,7) (2,3) (1,5,6,7) (3,5,7) (1,2,3) R1 R2 R3 R4 R1 ⋈A R2 ⋈B R3 ⋈C R4 Felix Naumann, VL Informationsintegration, WS 05/06

53 Fully Reduce Gegeben Baum-Anfrage Q (R4 ⋈C (R3 ⋈D R5)) ⋈B (R1 ⋈A R2)
Auswahl der Wurzel beliebig R1 R1 R3 R5 R2 R3 R2 R4 R4 R5 Baumdarstellung rein graphisch! Felix Naumann, VL Informationsintegration, WS 05/06

54 Felix Naumann, VL Informationsintegration, WS 05/06
Fully Reduce Phase 1 Von unten nach oben Ziel: Full reducer für Wurzel Einführung von Semi-Joins von Knoten zu ihren Eltern Phase 2 Von oben nach unten Ziel: Full reducer für alle anderen Knoten Einführung von Semi-Joins von Knoten zu ihren Kindern R1 R2 R3 R4 R5 Felix Naumann, VL Informationsintegration, WS 05/06

55 Felix Naumann, VL Informationsintegration, WS 05/06
Fully Reduce – Phase 1 Erfüllte Bedingungen: R3.C = R4.C R3.D = R5.D R1.A = R2.A R1.B = R3.B R1 R1 R1 R2 R3 R2 R3 R2 R3 R4 R5 R4 R5 R4 R5 Erfüllte Bedingungen: R3.C = R4.C R3.D = R5.D Ergebnis in R1 erfüllt alle Beding- ungen, ist also fully reduced. Felix Naumann, VL Informationsintegration, WS 05/06

56 Optimierung mit Semi-Join
Mitarbeiter, die an Projekten der eigenen Abteilung arbeiten Zyklische Anfragen SELECT EMP.name, DEPT.name FROM EMP, DEPT, PROJ WHERE EMP.d_ID = DEPT.ID AND EMP.p_ID = PROJ.ID AND PROJ.d_ID = DEPT.ID DEPT DName ID a 1 b 2 PROJ d_ID ID PName 1 6 Clio 2 7 HumMer PROJECTS EMP EName d_ID p_ID X 1 7 y 2 6 EMPLOYEES DEPARTMENTS Problem: Semi-Join betrachtet immer nur eine Kante im Anfragebaum und blickt nicht voraus. Ergebnis ist nie die leere Menge. Felix Naumann, VL Informationsintegration, WS 05/06

57 Felix Naumann, VL Informationsintegration, WS 05/06
Überblick Anfragebearbeitung im Überblick Techniken der Verteilten Anfragebearbeitung Row Blocking Multicasts Multithreading Partitionierung Joinbearbeitung Semi-Join Reduzierung Semi-Join mit Filter Felix Naumann, VL Informationsintegration, WS 05/06

58 Optimierung mit Semi-Join
Verbesserung durch Hashfilter Idee: Statt A(R) sende man nur eine „Signatur“ (Bloom-Filter). Weniger Netzwerkverkehr. Felix Naumann, VL Informationsintegration, WS 05/06

59 Join mit Hashfilter (Bloom-Filter)
15 Werte ⋈C 12 Werte (4 Tupel, inkl. 2 False Drops) 1 1 6 Bit False drops Quelle: VL-Folien, Alfons Kemper, Uni Passau Felix Naumann, VL Informationsintegration, WS 05/06

60 Felix Naumann, VL Informationsintegration, WS 05/06
Rückblick Site 1 Techniken der verteilten Anfragebearbeitung Row Blocking Multicasts Multithreading Partitionierung Semi-Join Basics Reduzierung Mit Filter Site 0 receive send send receive S ID R Felix Naumann, VL Informationsintegration, WS 05/06

61 Felix Naumann, VL Informationsintegration, WS 05/06
Literatur Überblick Fast jedes deutsche DBMS Lehrbuch Englisch: [GMUW00] Hector Garcia-Molina, Jeffrey D. Ullman, Jennifer Widom: Database System Implementation Prentice-Hall 2000 Spezielles [Ko00] The State of the Art in Distributed Query Processing, Donald Kossmann, ACM Computing Surveys 32(4), pages (Link auf WWW) [Graefe93] Goetz Graefe: Query Evaluation Techniques for Large Databases. ACM Comput. Surv. 25(2): (1993) Semijoin [BC81] Philip A. Bernstein, Dah-Ming W. Chiu: Using Semi-Joins to Solve Relational Queries. Journal of the ACM 28(1): (1981) Felix Naumann, VL Informationsintegration, WS 05/06

62 Verteilter Hash-Join – Build Phase
Send R S receive Puffer Hashtabelle Quelle: VL-Folien, Alfons Kemper, Uni Passau Felix Naumann, VL Informationsintegration, WS 05/06

63 Verteilter Hash-Join – Probe Phase
Hashtabelle Puffer h(...) receive receive Send R Send S Quelle: VL-Folien, Alfons Kemper, Uni Passau Felix Naumann, VL Informationsintegration, WS 05/06

64 Double-Pipelined Hash Join
1. Phase: Build-Input (mit kleinerer Relation) Build muß vollständig vorhanden sein. 2. Phase: Probe-Input Erlaubt Bearbeitung noch während Empfang (pipeline) Double-Pipelined Build und Probe zugleich: Hash-Tabelle für beide Inputströme Günstig für integrierte Systeme wg. verzögerter pipelines (s.a. Row Blocking) Felix Naumann, VL Informationsintegration, WS 05/06

65 Double-Pipelined Hash Join
Ergebnis-Tupel Hashtabelle Hashtabelle einfügen probe receive receive Send R Send S Quelle: VL-Folien, Alfons Kemper, Uni Passau Felix Naumann, VL Informationsintegration, WS 05/06


Herunterladen ppt "Informationsintegration Verteilte Anfragebearbeitung"

Ähnliche Präsentationen


Google-Anzeigen