Upload
vuongquynh
View
235
Download
0
Embed Size (px)
Citation preview
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle Database In-Memory
Markus Kißling Product Manager for Database In-Memory DOAG Datenbank 2017
Die richtigen Werkzeuge DOAG Datenbank 2017
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
2
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
Oracle Database In-Memory im Überblick
AWR-Report
Der Klassiker: SQL*Plus
Oracle SQL Developer
Advisors
EM Cloud Control
SQL Monitor
Weitere Informationen
1
2
3
4
5
6
7
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Column
SALES
Row
SALES
Klassischer Zeilenansatz vs. spaltenorientierter Speicherung
4
• OLTP läuft am Besten mit Zeilen-Format – Operationen auf wenigen Zeilen, vielen Spalten – Beispiel: Insert, Update oder Abfragen auf Tabellen
• DWH Abfragen laufen am Schnellsten Spalten-Format – Operationen auf wenige Spalten, viele Zeilen – Beispiel: Auswertung Summe aller Verkäufe pro Region
Bisher gab es nur die Entweder-Oder-Entscheidung
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• Beides - Row und Column In-Memory Formate - für die gleiche Tabelle
• Real Time Analysen nutzen das neue Column Format
• OLTP Applikationen nutzen das Row Format
• Erhalt der Transaktionskonsistenz
Memory Memory
SALES SALES
Row Format
Column Format
Das duale Format in der Datenbank
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 6
In-Memory Columnar Technologie
Storage Indexes Compression
Scan & Filtern auf komprimierte Daten
Zugriff nur auf benötigte Spalten
Columnar Format SIMD Vector Processing
Mehrere Spaltenwerte mit einer einzigen CPU- Instruktion verarbeiten
Vec
tor
Reg
iste
r
Load multiple region values
Vector Compare all values an 1 cycle
CPU CA
CA
CA
CA
Min 1 Max 3
Min 4 Max 7
Min 8 Max 12
Überspringen der nicht benötigten Daten einer
Spalte
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Was sind analytische Abfragen?
Welche Produkte liefern uns die
höchste Gewinnspanne
(Marge)?
Wer sind die Top 10 Vertriebsmitarbeiter in der Region Süd in
diesem Monat?
Wenn ich einen Rabatt von 20 % auf
Teil XY bekomme, wie wirkt sich dies auf die Gewinnspanne aus?
7
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Analytische Abfragen profitieren durch den Zugriff auf den IM Column Store
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• Memory-Bandbreite nutzen
• Scan und Filter auf benötigten Spalten
• Vektor-Instruktionen
Database In-Memory: Real-time Analytics Analytische Abfragen beschleunigen
Data Scans
Vec
tor
Reg
iste
r CPU CA
CA
CA
CA
In-Memory Aggregation
• In-Memory Report Outline wird beim ersten Scan der kleinen Tabellen erzeugt •Report wird beim Scan der großen
Tabelle befüllt
Joins
•Star Joins werden in Spalten Scans konvertiert, Faktor 10X schneller •Große Tabelle wird mit
passenden Werten der kleinen Tabelle direkt verglichen
HASH JOIN
Table A Table B
SALES ST
ATE
= C
A
9
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• Star-Schema und vorberechnete KPIs
- Verbessert die Performance von Dash-Boards
• Alle Bereiche oder ein Subset des Foundation Layers
- Bei zeitintensiven analytischen Abfragen in der dritten Normalform
• Staging/ETL/Temp sind keine Kandidaten
- Einmal Schreiben, einmal lesen
10
In-Memory – Der größte Nutzen
ODS
ETL
In-Memory Column Store
SALES
Reporting OLTP System
• Ermöglicht Real-Time Reporting direkt auf OLTP Daten
• Beschleunigt Mixed Workload
• Kann einen separaten ODS überflüssig machen
• Datenextraktionsteil beim ETL Prozess beschleunigen
In-Memory Column Store
Reporting
Data Warehouse
Foundation Layer Staging Layer Performance Layer
STAR SCHEMA
Pre-Cal KPIs
3rd Normal Form
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle Database In-Memory Weniger geeignet bei…
• Network Round Trips, Logon/Logoff
• Parsing, PL/SQL, komplexen Funktionen
• Datenverarbeitung (im Gegensatz zu Datenzugriff) – Inserts, Updates oder Deletes
– Komplexe Joins oder Aggregationen, ohne vorher Daten vor der Verarbeitung herauszufiltern
• Laden und einmal selektieren – Staging Tabellen, ETL, Temp Tabellen
11
Die Engpässe kennen!
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle Database In-Memory Darauf achten…
• Zeilenweise Verarbeitung vermeiden – Stattdessen Datasets in der Datenbank verarbeiten
• Den Optimizer unterstützen – Representative Statistiken mit DBMS_STATS sammeln
• Parallelisierung nutzen
• In-Memory kann I/O Engpässe entlasten
• Aktuelle Database Proactive Bundle Patches einspielen
12
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Vorbereitungen
• Database In-Memory benötigt 12.1.0.2 /12.2.0.1 EE
• Aktuellen Database Proactive Bundle Patch – Keine PSUs oder CPUs (SPUs)
– MOS Note: 1937782.1 als Einstieg
• Upgrades – Regressionen verhindern – Execution Pläne aufbewahren (SQL Plan Management)
– Optimizer Statistiken ebenfall aufbewahren
• 11g Baseline der 12c Umgebung gegenüberstellen – Erst dann Database In-Memory aktivieren
Oracle Database 12c
Oracle Confidential – Internal
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
• Größe des Column Stores wird über INMEMORY_SIZE Parameter gesteuert
• Enthalten in SGA_TARGET, deshalb groß genug dimensionieren
• PGA entsprechend einstellen, wichtig für Joins & Aggregationen
• Siehe MOS Note 1903683.1
• Evtl. vorhandene Underscore Parameter deaktivieren
• Wichtige In-Memory Parameter:
– INMEMORY_SIZE
– PARALLEL_DEGREE_POLICY AutoDOP einschalten, wird für RAC Umgebungen benötigt
• AWR ist hilfreich, um den Workload auf System-Ebene zu bestimmen
• AWR gibt Einblick in Setup der Datenbank
– Initialisierungsparameter
– Speicherallokierung
– Resourcennutzung
– Advisor Sektion beachten
• Standardmäßige AWR Retention von 7 Tagen ggf. erhöhen
Vorbereitungen
Performance Historie Init.ora Parameter Speicherallokierung Note: Speicher nicht von anderen benötigten Komponenten wegnehmen
Note: Mit Default Parameter beginnen!
Note: AWR hilft nicht bei unvorteilhaften SQL
Oracle Database 12c
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
Oracle Database In-Memory im Überblick
AWR-Report
Der Klassiker: SQL*Plus
Oracle SQL Developer
Advisors
EM Cloud Control
SQL Monitor
Weitere Informationen
1
2
3
4
5
6
7
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Anwendungsbeispiel für Oracle Database In-Memory
• 100 User führen je 10 Abfragefolgen parallel aus ...
- Höchster Bestellwert
- Umsatz nach Kunde, Versandsart, Priorität - Summe Kundenumsätze, Monat, Rabatt, Menge
LINEORDER (Faktentabelle) 600.037.897 Rows ROW STORE COMPRESS BASIC 4.587.520 Blocks a’ 8KB LINEORDER Size 35 GB Column Store Size (query_low) 31,7278 GB Dimensionen: CUSTOMER 3.000.000 Rows / 0,26 GB (Platte)/ 0,2114 GB (IM) PART 1.400.000 Rows / 0,125 GB / 0,0286 GB SUPPLIER 200.000 Rows / 0,0625 GB / 0,0148 GB DATE_DIM 2.556 Rows / 0,0625 GB / 0,0011 GB
Ermitteln der Kandidaten für den IM Column Store
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Vorgehen: Anwenderbefragung und AWR-Report
I_R_NOIM_NC_IND_IT10_VU100(S312)/mk_awrrpt_1_242_244.html
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Kandidaten für den IM Column Store ermitteln
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Ein Kandidat für den IM Column Store
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Abfrageläufe erneut ausführen mit aktivem IM Column Store
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Buffer Cache (BC) vs. Column Store (CS)
BC
CS
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Elapsed Time und DB Time drastisch reduziert
Buffer Cache Column Store
I_R_NOIM_NC_IND_IT10_VU100(S312)/mk_awrrpt_1_242_244.html I_R_IM_VU100(S303)/mk_awrrpt_1_123_124.html
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
Oracle Database In-Memory im Überblick
AWR-Report
Der Klassiker: SQL*Plus
Oracle SQL Developer
Advisors
EM Cloud Control
SQL Monitor
Weitere Informationen
1
2
3
4
5
6
7
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Der Klassiker: SQL*Plus
24
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Der Klassiker: SQL*Plus
25
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Der Klassiker: SQL*Plus
26
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Der Klassiker: SQL*Plus
27
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
Oracle Database In-Memory im Überblick
AWR-Report
Der Klassiker: SQL*Plus
Oracle SQL Developer
Advisors
EM Cloud Control
SQL Monitor
Weitere Informationen
1
2
3
4
5
6
7
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle SQL Developer
29
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle SQL Developer
30
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Oracle SQL Developer
31
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
Oracle Database In-Memory im Überblick
AWR-Report
Der Klassiker: SQL*Plus
Oracle SQL Developer
Advisors
EM Cloud Control
SQL Monitor
Weitere Informationen
1
2
3
4
5
6
7
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
In-Memory Advisor Compression Advisor
Advisors für Database In-Memory
• Analysiert DB Workload über AWR & ASH Repositories
• Liefert Liste von Kandidaten, die vom IM Column Store am meisten profitieren
• Nutzbar ab Oracle 11.2.0.3 Umgebungen
• MOS Note 1965343.1 (neue Version 2.0)
• Tuning Pack erforderlich
• Speichergröße (In-Memory Area) einfach bestimmbar
• Nutzt DBMS_COMPRESSION
• Wendet MEMCOMPRESS auf Sample Set der Tabellendaten an (gilt für alle Komprimierungstypen)
• Geschätzter Compression Ratio wird zurückgegeben
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
Oracle Database In-Memory im Überblick
AWR-Report
Der Klassiker: SQL*Plus
Oracle SQL Developer
Advisors
EM Cloud Control
SQL Monitor
Weitere Informationen
1
2
3
4
5
6
7
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Monitoring in EM Cloud Control 12c: In-Memory Central
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Monitoring in EM Cloud Control 13c: In-Memory Central
36
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
Oracle Database In-Memory im Überblick
AWR-Report
Der Klassiker: SQL*Plus
Oracle SQL Developer
Advisors
EM Cloud Control
SQL Monitor
Weitere Informationen
1
2
3
4
5
6
7
8
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
SQL Monitor
38
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Data Scans
39
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Scannen & Filtern bei Abfragen
• Diese Abfrage liefert die Gesamtzahl der Bestellungen und der Bestellsumme der Waren, die über Luftfracht geliefert wurden.
40
SELECT
count(*),
SUM(l.lo_ordtotalprice)
FROM lineorder l
WHERE l.lo_shipmode = 'AIR';
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Scannen & Filtern bei Abfragen: Traditioneller Datenzugriff
41
Größter Zeitanteil für Datenzugriff
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Scannen & Filtern bei Abfragen: Mit Database In-Memory
42
Zeit für Scannen und
Filtern der Daten
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Joins
43
HASH JOIN
Table A Table B
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Abfrage mit Joins
• Abfrage des kompletten Umsatzes einer bestimmten Marke. Eingeschränkt auf eine bestimmte Kategorie und Region
44
SELECT p.p_brand1,
SUM(lo_revenue) rev
FROM lineorder l,
part p,
supplier s
WHERE l.lo_partkey = p.p_partkey
AND l.lo_suppkey = s.s_suppkey
AND p.p_category = 'MFGR#12'
AND s.s_region = 'AMERICA'
GROUP BY p.p_brand1
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 45
Abfrage mit Joins - Traditioneller Hash Join
Meiste Zeit für Joinen der Daten
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 46
Abfrage mit Joins – Hash Join mit Bloom Filtern
Meiste Zeit jetzt für Scannen &
Filtern der Daten
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Aggregation
47
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Abfrage mit Aggregation
48
• Abfrage des Gewinnes eines Jahres und einer Nation
SELECT d.d_year, c.c_nation, sum(lo_revenue - lo_supplycost)
FROM LINEORDER l, DATE_DIM d, PART p, SUPPLIER s, CUSTOMER c
WHERE l.lo_orderdate = d.d_datekey
AND l.lo_partkey = p.p_partkey
AND l.lo_suppkey = s.s_suppkey
AND l.lo_custkey = c.c_custkey
AND s.s_region = 'AMERICA'
AND c.c_region = 'AMERICA'
GROUP BY d.d_year, c.c_nation
ORDER BY d.d_year, c.c_nation;
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 49
Aggregation – Traditioneller Group By
Meiste Zeit beim Scannen und beim
Group By
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. | 50
Aggregation – Vector Group By with In-Memory
Group By nun innerhalb der Scans &
Filter Operation
Copyright © 2017, Oracle and/or its affiliates. All rights reserved. |
Agenda
Oracle Database In-Memory im Überblick
AWR-Report
Der Klassiker: SQL Plus
Oracle SQL Developer
Advisors
EM Cloud Control
SQL Monitor
Weitere Informationen
1
2
3
4
5
6
7
8
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Join the Conversation
52
https://twitter.com/dbim_markus
https://blogs.oracle.com/in-memory/
White Papers (otn.com) • Oracle Database In-Memory White Paper • Oracle Database In-Memory Aggregation Paper • When to use Oracle Database In-Memory • Oracle Database In-Memory Advisor Videos • Oracle Database In-Memory YouTube Channel • oracle.com - Powering the Real-Time Enterprise - Industry Experts Share Perspectives oracle.com/us/corporate/events/dbim/index.html
• YouTube - Juan Loaiza: Software in Silicon Additional Questions • In-Memory blog: blogs.oracle.com/In-Memory • My email: [email protected]
https://www.facebook.com/OracleDatabase
http://www.oracle.com/goto/dbim.html
Additional Resources
Copyright © 2015, Oracle and/or its affiliates. All rights reserved. |
Q & A
53