datenbanken unit 9: olap, oltp, data warehouse ranking...
TRANSCRIPT
![Page 1: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/1.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
DatenbankenUnit 9: OLAP, OLTP, Data Warehouse
Ranking Algorithmen
Ronald Ortner
28. V. 2018
Ronald Ortner
![Page 2: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/2.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Outline
1 Organisatorisches
2 OLTP, OLAP, SAP, and Data WarehouseOLTP and OLAPSAPData Warehouse & OLAP
3 Ranking
4 SQL
Ronald Ortner
![Page 3: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/3.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Organisatorisches
Ergebnisse 2. Zwischentest (Einsichtnahme in den UE)
Nächste Woche letzte Wissensüberprüfung(Thema: Datumsfunktionen/Stoff von heute)
UE-Abschlusstest am 13. Juni(Gruppe 1: 14:45–16:00, Gruppe 2: 16:00–17:15 ??)
Ronald Ortner
![Page 4: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/4.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
OLTP and OLAP
Outline
1 Organisatorisches
2 OLTP, OLAP, SAP, and Data WarehouseOLTP and OLAPSAPData Warehouse & OLAP
3 Ranking
4 SQL
Ronald Ortner
![Page 5: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/5.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
OLTP and OLAP
OLTP vs. OLAP
OLTP: online transaction processingOnline-DatenbankanwendungenBeispiele: Bestellungen, Buchungen, etc.wichtig ist die Verarbeitung aktuell anfallender Daten→ viele Updates und neue Einträge in der Datenbank
OLAP: online analytical processingDatenbankanwendungen für Analyse und Decision SupportBeispiele: Trendanalyse, Big Datahistorische Daten sind wichtig→ viele Daten, die meist in aggregierter Form benötigt werden
Ronald Ortner
![Page 6: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/6.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
OLTP and OLAP
OLTP vs. OLAP
OLTP: online transaction processingOnline-DatenbankanwendungenBeispiele: Bestellungen, Buchungen, etc.wichtig ist die Verarbeitung aktuell anfallender Daten→ viele Updates und neue Einträge in der Datenbank
OLAP: online analytical processingDatenbankanwendungen für Analyse und Decision SupportBeispiele: Trendanalyse, Big Datahistorische Daten sind wichtig→ viele Daten, die meist in aggregierter Form benötigt werden
Ronald Ortner
![Page 7: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/7.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
SAP
Outline
1 Organisatorisches
2 OLTP, OLAP, SAP, and Data WarehouseOLTP and OLAPSAPData Warehouse & OLAP
3 Ranking
4 SQL
Ronald Ortner
![Page 8: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/8.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
SAP
SAP
SAP: Softwaresystem, hauptsächlich für OLTP
SAP hat drei Ebenen:großes relationales Datenbanksystem im HintergrundApplikationen, die auf Datenbank aufsetzenGUI
Zugriff auf dahinterliegende Datenbanken:Auf einige Tabellen kann normal via SQL zugegriffen werden.Dabei ist meist nur lesender Zugriff sinnvoll.Auf andere Tabellen kann nur via SAP zugegriffen werden.
Ronald Ortner
![Page 9: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/9.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
SAP
SAP
SAP: Softwaresystem, hauptsächlich für OLTP
SAP hat drei Ebenen:großes relationales Datenbanksystem im HintergrundApplikationen, die auf Datenbank aufsetzenGUI
Zugriff auf dahinterliegende Datenbanken:Auf einige Tabellen kann normal via SQL zugegriffen werden.Dabei ist meist nur lesender Zugriff sinnvoll.Auf andere Tabellen kann nur via SAP zugegriffen werden.
Ronald Ortner
![Page 10: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/10.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
SAP
SAP
SAP: Softwaresystem, hauptsächlich für OLTP
SAP hat drei Ebenen:große relationales Datenbanksystem im HintergrundApplikationen, die auf Datenbank aufsetzenGUI
Eigene Applikationen könne mit ABAP/4 geschrieben werden –Datenbankzugriff mit
Native SQL (mit speziellem User Interface)Open SQL (direkter Zugriff auf Datenbanken)
Ronald Ortner
![Page 11: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/11.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Outline
1 Organisatorisches
2 OLTP, OLAP, SAP, and Data WarehouseOLTP and OLAPSAPData Warehouse & OLAP
3 Ranking
4 SQL
Ronald Ortner
![Page 12: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/12.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
OLTP vs. OLAP
OLTP: online transaction processingOnline-DatenbankanwendungenBeispiele: Bestellungen, Buchungen, etc.wichtig ist de Verarbeitung aktuell anfallender Daten→ viele Updates und neue Einträge in der Datenbank
OLAP: online analytical processingDatenbankanwendungen für Analyse und Decision SupportBeispiele: Trendanalyse, Big Datahistorische Daten sind wichtig→ viele Daten, die meist in aggregierter Form benötigt werden
→ Es ist keine gute Idee, OLTP und OLAP auf derselben Datenbankauszuführen.
Ronald Ortner
![Page 13: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/13.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
OLTP vs. OLAP
OLTP: online transaction processingOnline-DatenbankanwendungenBeispiele: Bestellungen, Buchungen, etc.wichtig ist de Verarbeitung aktuell anfallender Daten→ viele Updates und neue Einträge in der Datenbank
OLAP: online analytical processingDatenbankanwendungen für Analyse und Decision SupportBeispiele: Trendanalyse, Big Datahistorische Daten sind wichtig→ viele Daten, die meist in aggregierter Form benötigt werden
→ Es ist keine gute Idee, OLTP und OLAP auf derselben Datenbankauszuführen.
Ronald Ortner
![Page 14: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/14.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Data Warehouse
Grundidee von Data Warehouse:Operationale Datenbank für OLTPSpeichere regelmäßig (aber nicht online!) Daten von operationalerDatenbank in Data Warehouse
Datenbankschemata für Data Warehouse:Sternschema:
eine zentrale Faktentabelleandere Tabellen nicht normalisiert
Schneeflockenschema:eine zentrale Faktentabelleandere Tabellen normalisiert (→ benötigt mehr Joins)
Ronald Ortner
![Page 15: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/15.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Data Warehouse
Grundidee von Data Warehouse:Operationale Datenbank für OLTPSpeichere regelmäßig (aber nicht online!) Daten von operationalerDatenbank in Data Warehouse
Datenbankschemata für Data Warehouse:Sternschema:
eine zentrale Faktentabelleandere Tabellen nicht normalisiert
Schneeflockenschema:eine zentrale Faktentabelleandere Tabellen normalisiert (→ benötigt mehr Joins)
Ronald Ortner
![Page 16: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/16.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Data Warehouse
Grundidee von Data Warehouse:Operationale Datenbank für OLTPSpeichere regelmäßig (aber nicht online!) Daten von operationalerDatenbank in Data Warehouse
Datenbankschemata für Data Warehouse:Sternschema:
eine zentrale Faktentabelleandere Tabellen nicht normalisiert
Schneeflockenschema:eine zentrale Faktentabelleandere Tabellen normalisiert (→ benötigt mehr Joins)
Ronald Ortner
![Page 17: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/17.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Roll Up und Drill Down
Abfragen auf Data Warehouse typischerweise in aggregierter Form(→ GROUP BY)
Drill down: mehr Attribute im GROUP BY
Roll up: weniger Attribute im GROUP BY
Daten können in einer Tabelle bzw. allgemein im “Data cube”dargestellt werden.
Ronald Ortner
![Page 18: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/18.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Cube Operator
Data cube:
Ausführung aller nötigen Abfragen aufwendig
können Tabelle für Data cube speichern(mit NULL Werten, wo aggregiert wird)immer noch recht aufwendig und unpraktisch→ Idee: neuer SQL Operator CUBEVerwendung: GROUP BY CUBE( attr1, attr2, . . .)Weitere Möglichkeit:
speichern Tabelle, die maximal “drilled-down” istaggregieren diese Tabelle(weniger aufwendig als Aggregation jedesmal neu zu machen)
Ronald Ortner
![Page 19: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/19.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Cube Operator
Data cube:
Ausführung aller nötigen Abfragen aufwendigkönnen Tabelle für Data cube speichern(mit NULL Werten, wo aggregiert wird)
immer noch recht aufwendig und unpraktisch→ Idee: neuer SQL Operator CUBEVerwendung: GROUP BY CUBE( attr1, attr2, . . .)Weitere Möglichkeit:
speichern Tabelle, die maximal “drilled-down” istaggregieren diese Tabelle(weniger aufwendig als Aggregation jedesmal neu zu machen)
Ronald Ortner
![Page 20: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/20.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Cube Operator
Data cube:
Ausführung aller nötigen Abfragen aufwendigkönnen Tabelle für Data cube speichern(mit NULL Werten, wo aggregiert wird)immer noch recht aufwendig und unpraktisch
→ Idee: neuer SQL Operator CUBEVerwendung: GROUP BY CUBE( attr1, attr2, . . .)Weitere Möglichkeit:
speichern Tabelle, die maximal “drilled-down” istaggregieren diese Tabelle(weniger aufwendig als Aggregation jedesmal neu zu machen)
Ronald Ortner
![Page 21: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/21.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Cube Operator
Data cube:
Ausführung aller nötigen Abfragen aufwendigkönnen Tabelle für Data cube speichern(mit NULL Werten, wo aggregiert wird)immer noch recht aufwendig und unpraktisch→ Idee: neuer SQL Operator CUBEVerwendung: GROUP BY CUBE( attr1, attr2, . . .)
Weitere Möglichkeit:speichern Tabelle, die maximal “drilled-down” istaggregieren diese Tabelle(weniger aufwendig als Aggregation jedesmal neu zu machen)
Ronald Ortner
![Page 22: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/22.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Data Warehouse & OLAP
Cube Operator
Data cube:
Ausführung aller nötigen Abfragen aufwendigkönnen Tabelle für Data cube speichern(mit NULL Werten, wo aggregiert wird)immer noch recht aufwendig und unpraktisch→ Idee: neuer SQL Operator CUBEVerwendung: GROUP BY CUBE( attr1, attr2, . . .)Weitere Möglichkeit:
speichern Tabelle, die maximal “drilled-down” istaggregieren diese Tabelle(weniger aufwendig als Aggregation jedesmal neu zu machen)
Ronald Ortner
![Page 23: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/23.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Ranking
Aufgabe:haben mehrere Listen derselben Objekte, gereiht nachverschiedenen Kriterienaggregieren die verschiedenen Kriterien zu einem Wert(einfachster Fall: Summe)hätten gerne die besten k Objekte
Naive Lösung:Berechnen Wert für alle Objekte und sortieren
Bessere Lösung:Threshold AlgorithmusNo Random Access Algorithmus
(für Details siehe Folien von Alois Kemper)Ronald Ortner
![Page 24: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/24.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
SQL
Heute:Nachbetrachtung WissensüberprüfungenErgänzungen zu COUNT und Joins
Ronald Ortner
![Page 25: Datenbanken Unit 9: OLAP, OLTP, Data Warehouse Ranking ...institute.unileoben.ac.at/infotech/lehre/db/SS2018/Unit9.pdfOrganisatorisches OLTP, OLAP, SAP, and Data WarehouseRankingSQL](https://reader030.vdocuments.site/reader030/viewer/2022040711/5e126f48dc22785345127f87/html5/thumbnails/25.jpg)
Organisatorisches OLTP, OLAP, SAP, and Data Warehouse Ranking SQL
Nachbetrachtung Zwischentest
Zusätzliche Bedingungen in (korrel.) Subqueries innen und außen!Falsche Korrelationen liefern falsche Ergebnisse.Unabsichtliche KorrelationenCOUNT 6= SUM
Eine Subtilität:Oft sollte im GROUP BY nicht der Ausdruck im SELECT sondernentsprechende id verwendet werden.
Ronald Ortner