Informationsintegration Verteilte Anfragebearbeitung

Slides:



Advertisements
Ähnliche Präsentationen
Algorithmen und Datenstrukturen
Advertisements

Kapitel 8 Anfragebearbeitung
Partitionierungstechniken in Datenbanksystemen
Kapitel 8 Anfragebearbeitung Logische Optimierung Physische Optimierung Kostenmodelle Tuning.
Heterogene Informationssysteme
Seminar Service Aspects in ad-hoc and P2P networks Database functionality in P2P-networks von Thorsten Weiberg.
Hash-Tabellen und -Funktionen Hash-Tabellen in Java
Vorlesung: 1 Betriebliche Informationssysteme 2003 Prof. Dr. G. Hellberg Studiengang Informatik FHDW Vorlesung: Betriebliche Informationssysteme Teil3.
Folien 2-5, 7-8 © Prof. Dr. Manfred Rössle (FH Aalen)
Informationsintegration Heterogenität Felix Naumann.
Informationsintegration Local-as-View: LaV
Informationsintegration Der Bucket-Algorithmus Felix Naumann.
Informationsintegration Dynamische Programmierung
Informationsintegration Top-N Anfragen
Informationsintegration Einführung
Informationsintegration ETL & Datenherkunft (Lineage)
Informationsintegration Global-as-View: GaV
Informationsintegration Containment und Local-as-View Anfragebearbeitung Felix Naumann.
Informationsintegration SchemaSQL Felix Naumann.
Kapitel 8 Anfragebearbeitung
Bauinformatik II Softwareanwendungen 1
Anfrage-Optimierung und -Bearbeitung in Verteilten DBMS
Lehrstuhl Informatik III, DatenbanksystemeMartin Wimmer Übung zu Architektur und Implementierung von Datenbanksystemen 1 Implementierungen des Join- Operators.
Sortierverfahren Richard Göbel.
Sortierverfahren Richard Göbel.
FH-Hof Effizienz - Grundlagen Richard Göbel. FH-Hof Inhalt Einführung Aufwand für Anfragen ohne Indexierung Indexstrukturen für Anfragen an eine Tabelle.
Dynamische Programmierung (2) Matrixkettenprodukt
WS Algorithmentheorie 08 – Dynamische Programmierung (2) Matrixkettenprodukt Prof. Dr. Th. Ottmann.
Datenmodelle, Datenbanksprachen und Datenbankmanagementsysteme
IS: Datenbanken, © Till Hänisch 2000 CREATE TABLE Syntax: CREATE TABLE name ( coldef [, coldef] [, tableconstraints] ) coldef := name type [länge], [[NOT]NULL],
Universität Dortmund, Lehrstuhl Informatik 1 EINI II Einführung in die Informatik für Naturwissenschaftler und Ingenieure.
SQL/XML. © Prof. T. Kudraß, HTWK Leipzig 2 2 Motivation Speicherung von XML in allen großen kommerziellen DBMS vorhanden proprietäre Lösungen für die.
Vorlesung: 1 Betriebliche Informationssysteme 2003 Prof. Dr. G. Hellberg Studiengang Informatik FHDW Vorlesung: Betriebliche Informationssysteme Teil2.
Übung Datenbanksysteme SQL-Anfragen (2)
Access 2000 Datenbanken.
Optimierung von Anfragen an verteilte Datenbanksysteme
Seminar: Verteilte Datenbanken
Einführung Dateisystem <-> Datenbanksystem
Informationsintegration Architekturen
Informationsintegration Anwendungsszenarien
Informationsintegration Materialisierte vs. Virtuelle Integration
Christian Gebhardt Berlin,
Beispielrelation Buchbestellungen H = Menge der bedeutenden Ziele = {a, d} Schwelle T = 4 Stichprobe S = {a, b, a, a, a, a} mit s = |S| = 6 N = Anzahl.
Übung 1: SQL Übungen finden bei Bedarf anstelle der Vorlesungen statt
- Schnittmengenbildung -
Interoperable Informationssysteme - 1 Klemens Böhm Systeme 2: Query Processing - Grundlagen.
Die Grundterminologie
Syntaxanalyse Bottom-Up und LR(0)
1 J4 Hash-Join R und S werden mittels der gleichen Hashfunktion h – angewendet auf R.A und S.B – auf (dieselben) Hash- Buckets abgebildet Hash-Buckets.
SS 2004 Datenbanken 4W Mi 13:30 – 15:00 G 2.30 Vorlesung #7 SQL (Teil 2)
WS 2011/12 Datenbanksysteme Mi 15:15 – 16:45 R Vorlesung #9 Physische Datenorganisation.
WS 2011/12 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #8 Anfragebearbeitung.
WS 2013/14 Datenbanksysteme D0 15:15 – 16:45 R Vorlesung #5 SQL (Teil 2)
WS 2012/13 Datenbanksysteme Fr 15:15 – 16:45 R Vorlesung #9 Anfragebearbeitung.
WS 2007/08 Datenbanksysteme Mi 17:00 – 18:30 R Vorlesung #9 Anfragebearbeitung (Teil 1)
Datenbanksysteme für hörer anderer Fachrichtungen
Vorlesung #10 Physische Datenorganisation
WS 2013/14 Datenbanksysteme Do 17:00 – 18:30 R Vorlesung #9 Anfragebearbeitung.
SQL - Structured Query Language AIFB SS (1/9) Join-Operationen in SQL-92(1/9) Syntax einer Join-Operation: join-op := CROSS JOIN | [NATURAL]
Eike Schallehn, Martin Endig
WS 2004/2005 Datenbanken II - 5W Mi 17:00 – 18:30 G 3.18 Vorlesung #3 Anfragebearbeitung (Teil 1)
Einführung Dateisystem <-> Datenbanksystem
WS 2014/15 Datenbanksysteme D0 15:15 – 16:45 R Vorlesung #6 SQL (Teil 3)
Vorlesung Datenbanksysteme vom Anfragebearbeitung  Logische Optimierung.
Aufbau semantischer Caches und Anfrageverarbeitung Seminar Semantic Caching 1/12 Kathleen Hänsch
12. November 2001 Seminar Geoinformation Folie 1 Inhalt Einführung Bearbeitung raumbezogener Anfragen Ausblick Seminar Geoinformation Themenblock: „Implementierung.
1 StatiX: Making XML Count J.Freire, J.R.Haritsa, M.Ramanath, P.Roy, J.Siméon: StatiX: Making XML Count ACM SIGMOD, June 2002 Ann Früchtl
IS: Datenbanken, © Till Hänisch 2000 Relationenalgebra Die mathematische Grundlage von relationalen Datenbanken.
DOAG SID Data Warehouse
Abfragestrategien in verteilten Systemen
 Präsentation transkript:

Informationsintegration Verteilte Anfragebearbeitung 1.12.2005 Felix Naumann

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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! 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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,... 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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) 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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

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) 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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. 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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? 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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

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

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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) 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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) 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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? 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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)) 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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? 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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

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  1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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)*762534+LENGTH(RTRIM(titel))*464857 +(ASCII(substr(rtrim(titel),length(rtrim(titel)))))*659386 +(ASCII(SUBSTR(RTRIM(titel),(LENGTH(RTRIM(titel))/2)+1,1)))*121555 +(ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))*0.5573769496370024-0.5,0))+1,1)))*481517 +(ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))*0.5455918517007877-0.5,0))+1,1)))*418045 +(ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))*0.9390929989171091-0.5,0))+1,1)))*479165 +(ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))*0.3093312770038853-0.5,0))+1,1)))*151240 +(ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))*0.13964794618711818-0.5,0))+1,1)))*668683 +(ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))*0.7438338851875961-0.5,0))+1,1)))*208042 +(ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))*0.24890649793926223-0.5,0))+1,1)))*386682 +(ASCII(SUBSTR(RTRIM(titel),integer(round(length(rtrim(titel))*0.7727779326492414-0.5,0))+1,1)))*49285 FROM movie2.filme2 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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. 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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‘‘ 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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! 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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. 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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. 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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

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

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 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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 422-469. (Link auf WWW) [Graefe93] Goetz Graefe: Query Evaluation Techniques for Large Databases. ACM Comput. Surv. 25(2): 73-170 (1993) Semijoin [BC81] Philip A. Bernstein, Dah-Ming W. Chiu: Using Semi-Joins to Solve Relational Queries. Journal of the ACM 28(1): 25-40 (1981) 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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

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

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) 1.12.2005 Felix Naumann, VL Informationsintegration, WS 05/06

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