SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
SQL 2014 CTP1
Hekaton & CSI Version 2 unter der Lupe
Sascha Götz
Karlsruhe, 03. Dezember 2013
2
“Most of today’s database managers are built on the
assumption that data lives on a disk, with little bits of
data at a time loaded into memory for manipulation.
There’s a whole lot of infrastructure involved in paging
those subsets of data in and out[…]”
- Kevin Farlee, SQL Server program manager, Microsoft -
SQL 2014 CTP1
Hekaton – Memory optimized tables
3
Hekaton
SQL 2014 CTP1
Hekaton – Memory optimized tables
4
SQL 2014 CTP1
Hekaton – Memory optimized tables
SQL Server
Memory
Disk
Query
Cache
File
group
Index
Paging
Memory-OptimizedDisk-Based
Synchronisation
Index
Locking
Disk
(Memory Dump)
5
‣ Filegroup hinzufügen
ALTER DATABASE [AdventureWorksDW2012]
ADD FILEGROUP [Hekaton_FG]
CONTAINS MEMORY_OPTIMIZED_DATA
GO
‣ Datafile hinzufügen
ALTER DATABASE [AdventureWorksDW2012]
ADD FILE ( NAME = N'Hekaton', FILENAME = N'C:Hekaton.ndf')
TO FILEGROUP [Hekaton_FG]
GO
SQL 2014 CTP1
Hekaton – Memory optimized tables
6
CREATE TABLE [dbo].[FactInternetSales_Hekaton]
(
[ProductKey] [int] NOT NULL,
[OrderDateKey] [int] NOT NULL,
[...],
)
WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA)
‣ DURABILITY:
‣ SCHEMA_AND_DATA
‣ Schema und Daten werden mit Disk synchronisiert
‣ Speicherplatz wird im RAM und auf Disk benötigt
‣ SCHEMA_ONLY
‣ Nur Schema wird mit Disk synchronisiert
SQL 2014 CTP1
Hekaton – Memory optimized tables
7
‣ Natively Compiled Stored Procedure
CREATE PROCEDURE <Schema_Name, sysname, dbo>.<Procedure_Name, sysname,
Procedure_Name>
-- Add the parameters for the stored procedure here
[…]
WITH NATIVE_COMPILATION, SCHEMABINDING, EXECUTE AS OWNER
AS BEGIN ATOMIC WITH
--Insert statements for the stored procedure here
[…]
END
‣ Nur Abfrage auf In-Memory Tabellen
SQL 2014 CTP1
Hekaton – Memory optimized tables
8
‣ Index
‣ Memory Optimized tables müssen mindestens einen Index haben (auf PK)
‣ Keine Clustered Indizes
‣ Indexe werden nur im Speicher gehalten
‣ Kein Index Drop, Rebuild
‣ Max. 8 Index pro Tabelle
SQL 2014 CTP1
Hekaton – Memory optimized tables
CI Date
1 11.11.13
2 12.11.13
3 13.11.13
4 14.11.13
5 15.11.13
6 16.11.13
7 17.11.13
Date
13.11.13
16.11.13
14.11.13
17.11.13
15.11.13
11.11.13
12.11.13
Non-CI
1
2
3
4
5
6
7
I1 I2 … I8 Date Order# …
3 6 13.11.13 98165
6 2 16.11.13 98121
4 1 14.11.13 98474
7 3 17.11.13 98521
5 4 15.11.13 98451
1 5 11.11.13 98514
2 7 12.11.13 98563
9
‣ Limitations
‣ Keine Trigger
‣ Keine Foreign Key & Constraints
‣ Keine Identity columns
‣ Keine Schema changes (ALTER TABLE…)
SQL 2014 CTP1
Hekaton – Memory optimized tables
Demo
11
SQL 2014 CTP1
Hekaton – Memory optimized tables
40
4
20
1
0
5
10
15
20
25
30
35
40
45
Ohne Index Non-Clustered Index
Aggregierung (SUM & Group BY) über 2 Mio Datensätze
On-Disk In-Memory
DauerinSekunden
12
SQL 2014 CTP1
Hekaton – Memory optimized tables
32
52
60
0
10
20
30
40
50
60
70
1
Update 2 Mio Datensätze
On-Disk In-Memory In-Mermory + Natively Compiled
DauerinSekunden
13
SQL 2014 CTP1
Hekaton – Memory optimized tables
13
17
0
2
4
6
8
10
12
14
16
18
1
1 Mio. Datensätze Load
On-Disk In-Memory
DauerinSekunden
14
‣ Vorteile
‣ Performance
‣ Performance
‣ Performance
‣ Kritik
‣ Stabilität
‣ Speichermanagement
‣ Auslagerungs-Falle
‣ Fehlende Features (FKs, Identity Columns, Constraints)
‣ Bestehende Tabellen können nicht in die Hekaton Filegroup verschoben
werden
SQL 2014 CTP1
Hekaton – Memory optimized tables
15
‣ Einsatzzweck
‣ DURABILITY: SCHEMA_ONLY
‣ ETL Load Tabelle
‣ Temp Tabellen
‣ DURABILITY: SCHEMA_AND_DATA
‣ Log-Tabellen
SQL 2014 CTP1
Hekaton – Memory optimized tables
16
Columnstore Index 2
SQL 2014 CTP1
Columnstore Index
17
Non-Clustered
Columnstore Index
(SQL Server 2012)
• (+) Performance
• (+) Easy-To-Use
• (-) Read-Only
Clustered
Columnstore Index
(SQL Server 2014 CTP 1)
• (+) Performance
• (+) Easy-To-Use
• (+) Updateable
• (-) Keine PK & FK
• (-) Keine Constraints
SQL 2014 CTP1
Columnstore Index
18
106
71
9
1
0
20
40
60
80
100
120
1
Aggregierung (SUM & Group BY) über 25 Mio Datensätze
Ohne Index Non-Clustered Index Non-Clustered Columnstore Index Clustered Columnstore Index
SQL 2014 CTP1
Columnstore Index
DauerinSekunden
19
SQL 2014 CTP1
Columnstore Index
20
23
27
0
5
10
15
20
25
30
1 Mio. Datensätze Load
Ohne Index Non-Clustered Index Non-Clustered Columnstore Index Clustered Columnstore Index
Nichtmöglich
DauerinSekunden
Szenario: 25 Mio Datensätze, Non-Clustered CSI, 1 Mio Datensätze Load 20
‣ Daten doch Laden bei Non-Clustered Columnstore Index?
‣ Drop, Load and Rebuild
‣ Partition Swap
SQL 2014 CTP1
4
20
103
1
20
5
1
Columnstore Index
Split Load Build Swap
Drop Load Build
‣ HowTo: Partition Swapping
‣ Tabelle partitionieren
‣ Leere Partitionen
‣ Load in Temp laden
‣ Partition Split
‣ CSI Index erstellen
‣ Switch
21
SQL 2014 CTP1
Columnstore Index
<2011
2011
2012
2013
>2013
Facts
2011-2013
CSI
>2014
2014 2014
22
SQL 2014 CTP1
Columnstore Index
20
23
127
27 27
0
20
40
60
80
100
120
140
1 Mio. Datensätze Load
Ohne Index Non-Clustered Index Non-Clustered CSI
Non-Clustered CSI2 Clustered Columnstore Index
Partition
Swap
Drop&Rebuild
DauerinSekunden
23
‣ Fazit
‣ Query-Performance: Gigantisch
‣ Load-Performance: Mäßig bis Schlecht
‣ Nachteile: Vorhanden
‣ Einsatzzweck:
‣ Non-Clustered CSI
‣ BI Fact tables mit daily/nightly Loads
‣ Partition Swap oder Index Rebuild
‣ Clustered CSI
‣ Log Tabellen
‣ ‚Solo‘-Tabellen (ohne PK /FK)
SQL 2014 CTP1
Columnstore Index
24
SQL 2014 CTP1
Fragen?
25
‣ SQL Server Hekaton CTP1 White Paper
http://download.microsoft.com/download/F/5/0/F5096A71-3C31-4E9F-864E-
A6D097A64805/SQL_Server_Hekaton_CTP1_White_Paper.pdf
‣ http://blogs.msdn.com/b/arvindsh/archive/2013/07/03/sql-2014-in-memory-oltp-
hekaton-training-videos-and-white-papers.aspx
‣ http://www.databasejournal.com/features/mssql/new-enhanced-column-store-
index-in-sql-server-2014-part-1.html
‣ http://rusanu.com/2011/07/13/how-to-update-a-table-with-a-columnstore-index/
SQL 2014 CTP1
Ressources

Weitere ähnliche Inhalte

Ähnlich wie Hekaton & CSI Version 2 unter der Lupe

Datentransfer mit Oracle Tools
Datentransfer mit Oracle ToolsDatentransfer mit Oracle Tools
Datentransfer mit Oracle ToolsChristian Gohmann
 
Roadshow: What's new in Microsoft SQL Server 2016
Roadshow: What's new in Microsoft SQL Server 2016Roadshow: What's new in Microsoft SQL Server 2016
Roadshow: What's new in Microsoft SQL Server 2016Digicomp Academy AG
 
Best Practices SharePoint and SQL Installation
Best Practices SharePoint and SQL InstallationBest Practices SharePoint and SQL Installation
Best Practices SharePoint and SQL InstallationSamuel Zürcher
 
Roadshow Oracle Database 12c: News & Features
Roadshow Oracle Database 12c: News & FeaturesRoadshow Oracle Database 12c: News & Features
Roadshow Oracle Database 12c: News & FeaturesDigicomp Academy AG
 
Oracle Database 12c Release 2
Oracle Database 12c Release 2 Oracle Database 12c Release 2
Oracle Database 12c Release 2 oraclebudb
 
Domino Statistiken verstehen und nutzen (Teil 1) - 41. DNUG Konferenz
Domino Statistiken verstehen und nutzen (Teil 1) - 41. DNUG KonferenzDomino Statistiken verstehen und nutzen (Teil 1) - 41. DNUG Konferenz
Domino Statistiken verstehen und nutzen (Teil 1) - 41. DNUG Konferenzpanagenda
 
Oracle Database In-Memory Advisor (Deutsch)
Oracle Database In-Memory Advisor (Deutsch)Oracle Database In-Memory Advisor (Deutsch)
Oracle Database In-Memory Advisor (Deutsch)Ileana Somesan
 
Oracle 11g - Neuerungen im Überblick
Oracle 11g - Neuerungen im ÜberblickOracle 11g - Neuerungen im Überblick
Oracle 11g - Neuerungen im ÜberblickGFU Cyrus AG
 
Oracle Datenbank-Architektur
Oracle Datenbank-ArchitekturOracle Datenbank-Architektur
Oracle Datenbank-ArchitekturMarkus Flechtner
 
Angelika Gallwitz – IT-Tage 2015 – Statistische Auswertungen in Oracle mit S...
Angelika Gallwitz  – IT-Tage 2015 – Statistische Auswertungen in Oracle mit S...Angelika Gallwitz  – IT-Tage 2015 – Statistische Auswertungen in Oracle mit S...
Angelika Gallwitz – IT-Tage 2015 – Statistische Auswertungen in Oracle mit S...Informatik Aktuell
 
SplunkLive! Zürich 2016 - Use Case Helvetia
SplunkLive! Zürich 2016 - Use Case HelvetiaSplunkLive! Zürich 2016 - Use Case Helvetia
SplunkLive! Zürich 2016 - Use Case HelvetiaGeorg Knon
 
SplunkLive! Frankfurt 2016 - Helvetia Use Case
SplunkLive! Frankfurt 2016 - Helvetia Use CaseSplunkLive! Frankfurt 2016 - Helvetia Use Case
SplunkLive! Frankfurt 2016 - Helvetia Use CaseSplunk
 
SplunkLive! Zürich 2016 - Use Case Helvetia
SplunkLive! Zürich 2016 - Use Case HelvetiaSplunkLive! Zürich 2016 - Use Case Helvetia
SplunkLive! Zürich 2016 - Use Case HelvetiaSplunk
 
Zentrales Logging mit Elasticsearch
Zentrales Logging mit ElasticsearchZentrales Logging mit Elasticsearch
Zentrales Logging mit ElasticsearchSimonSchneider24
 
Oracle Technology Monthly Oktober 2017
Oracle Technology Monthly Oktober 2017Oracle Technology Monthly Oktober 2017
Oracle Technology Monthly Oktober 2017oraclebudb
 
SQL Server 2016 and SharePoint 2016 - Lars PLatzdasch - SQL Konferenz 2016
SQL Server 2016 and SharePoint 2016  - Lars PLatzdasch - SQL Konferenz 2016SQL Server 2016 and SharePoint 2016  - Lars PLatzdasch - SQL Konferenz 2016
SQL Server 2016 and SharePoint 2016 - Lars PLatzdasch - SQL Konferenz 2016Lars Platzdasch
 
Roadshow: «Whats new in sql server 2014»
Roadshow: «Whats new in sql server 2014»Roadshow: «Whats new in sql server 2014»
Roadshow: «Whats new in sql server 2014»Digicomp Academy AG
 
Webinar - Boost your ABAP
Webinar - Boost your ABAPWebinar - Boost your ABAP
Webinar - Boost your ABAPCadaxo GmbH
 
Big Data Konnektivität
Big Data KonnektivitätBig Data Konnektivität
Big Data KonnektivitätTrivadis
 
SAP HANA, Power Pivot, SQL Server – In-memory-Technologien im Vergleich
SAP HANA, Power Pivot, SQL Server – In-memory-Technologien im VergleichSAP HANA, Power Pivot, SQL Server – In-memory-Technologien im Vergleich
SAP HANA, Power Pivot, SQL Server – In-memory-Technologien im VergleichMarcel Franke
 

Ähnlich wie Hekaton & CSI Version 2 unter der Lupe (20)

Datentransfer mit Oracle Tools
Datentransfer mit Oracle ToolsDatentransfer mit Oracle Tools
Datentransfer mit Oracle Tools
 
Roadshow: What's new in Microsoft SQL Server 2016
Roadshow: What's new in Microsoft SQL Server 2016Roadshow: What's new in Microsoft SQL Server 2016
Roadshow: What's new in Microsoft SQL Server 2016
 
Best Practices SharePoint and SQL Installation
Best Practices SharePoint and SQL InstallationBest Practices SharePoint and SQL Installation
Best Practices SharePoint and SQL Installation
 
Roadshow Oracle Database 12c: News & Features
Roadshow Oracle Database 12c: News & FeaturesRoadshow Oracle Database 12c: News & Features
Roadshow Oracle Database 12c: News & Features
 
Oracle Database 12c Release 2
Oracle Database 12c Release 2 Oracle Database 12c Release 2
Oracle Database 12c Release 2
 
Domino Statistiken verstehen und nutzen (Teil 1) - 41. DNUG Konferenz
Domino Statistiken verstehen und nutzen (Teil 1) - 41. DNUG KonferenzDomino Statistiken verstehen und nutzen (Teil 1) - 41. DNUG Konferenz
Domino Statistiken verstehen und nutzen (Teil 1) - 41. DNUG Konferenz
 
Oracle Database In-Memory Advisor (Deutsch)
Oracle Database In-Memory Advisor (Deutsch)Oracle Database In-Memory Advisor (Deutsch)
Oracle Database In-Memory Advisor (Deutsch)
 
Oracle 11g - Neuerungen im Überblick
Oracle 11g - Neuerungen im ÜberblickOracle 11g - Neuerungen im Überblick
Oracle 11g - Neuerungen im Überblick
 
Oracle Datenbank-Architektur
Oracle Datenbank-ArchitekturOracle Datenbank-Architektur
Oracle Datenbank-Architektur
 
Angelika Gallwitz – IT-Tage 2015 – Statistische Auswertungen in Oracle mit S...
Angelika Gallwitz  – IT-Tage 2015 – Statistische Auswertungen in Oracle mit S...Angelika Gallwitz  – IT-Tage 2015 – Statistische Auswertungen in Oracle mit S...
Angelika Gallwitz – IT-Tage 2015 – Statistische Auswertungen in Oracle mit S...
 
SplunkLive! Zürich 2016 - Use Case Helvetia
SplunkLive! Zürich 2016 - Use Case HelvetiaSplunkLive! Zürich 2016 - Use Case Helvetia
SplunkLive! Zürich 2016 - Use Case Helvetia
 
SplunkLive! Frankfurt 2016 - Helvetia Use Case
SplunkLive! Frankfurt 2016 - Helvetia Use CaseSplunkLive! Frankfurt 2016 - Helvetia Use Case
SplunkLive! Frankfurt 2016 - Helvetia Use Case
 
SplunkLive! Zürich 2016 - Use Case Helvetia
SplunkLive! Zürich 2016 - Use Case HelvetiaSplunkLive! Zürich 2016 - Use Case Helvetia
SplunkLive! Zürich 2016 - Use Case Helvetia
 
Zentrales Logging mit Elasticsearch
Zentrales Logging mit ElasticsearchZentrales Logging mit Elasticsearch
Zentrales Logging mit Elasticsearch
 
Oracle Technology Monthly Oktober 2017
Oracle Technology Monthly Oktober 2017Oracle Technology Monthly Oktober 2017
Oracle Technology Monthly Oktober 2017
 
SQL Server 2016 and SharePoint 2016 - Lars PLatzdasch - SQL Konferenz 2016
SQL Server 2016 and SharePoint 2016  - Lars PLatzdasch - SQL Konferenz 2016SQL Server 2016 and SharePoint 2016  - Lars PLatzdasch - SQL Konferenz 2016
SQL Server 2016 and SharePoint 2016 - Lars PLatzdasch - SQL Konferenz 2016
 
Roadshow: «Whats new in sql server 2014»
Roadshow: «Whats new in sql server 2014»Roadshow: «Whats new in sql server 2014»
Roadshow: «Whats new in sql server 2014»
 
Webinar - Boost your ABAP
Webinar - Boost your ABAPWebinar - Boost your ABAP
Webinar - Boost your ABAP
 
Big Data Konnektivität
Big Data KonnektivitätBig Data Konnektivität
Big Data Konnektivität
 
SAP HANA, Power Pivot, SQL Server – In-memory-Technologien im Vergleich
SAP HANA, Power Pivot, SQL Server – In-memory-Technologien im VergleichSAP HANA, Power Pivot, SQL Server – In-memory-Technologien im Vergleich
SAP HANA, Power Pivot, SQL Server – In-memory-Technologien im Vergleich
 

Mehr von inovex GmbH

lldb – Debugger auf Abwegen
lldb – Debugger auf Abwegenlldb – Debugger auf Abwegen
lldb – Debugger auf Abwegeninovex GmbH
 
Are you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIAre you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIinovex GmbH
 
Why natural language is next step in the AI evolution
Why natural language is next step in the AI evolutionWhy natural language is next step in the AI evolution
Why natural language is next step in the AI evolutioninovex GmbH
 
Network Policies
Network PoliciesNetwork Policies
Network Policiesinovex GmbH
 
Interpretable Machine Learning
Interpretable Machine LearningInterpretable Machine Learning
Interpretable Machine Learninginovex GmbH
 
Jenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen UmgebungenJenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen Umgebungeninovex GmbH
 
AI auf Edge-Geraeten
AI auf Edge-GeraetenAI auf Edge-Geraeten
AI auf Edge-Geraeteninovex GmbH
 
Prometheus on Kubernetes
Prometheus on KubernetesPrometheus on Kubernetes
Prometheus on Kubernetesinovex GmbH
 
Deep Learning for Recommender Systems
Deep Learning for Recommender SystemsDeep Learning for Recommender Systems
Deep Learning for Recommender Systemsinovex GmbH
 
Representation Learning von Zeitreihen
Representation Learning von ZeitreihenRepresentation Learning von Zeitreihen
Representation Learning von Zeitreiheninovex GmbH
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenteninovex GmbH
 
Künstlich intelligent?
Künstlich intelligent?Künstlich intelligent?
Künstlich intelligent?inovex GmbH
 
Das Android Open Source Project
Das Android Open Source ProjectDas Android Open Source Project
Das Android Open Source Projectinovex GmbH
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning Interpretabilityinovex GmbH
 
Performance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use caseinovex GmbH
 
People & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessPeople & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessinovex GmbH
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumiinovex GmbH
 

Mehr von inovex GmbH (20)

lldb – Debugger auf Abwegen
lldb – Debugger auf Abwegenlldb – Debugger auf Abwegen
lldb – Debugger auf Abwegen
 
Are you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AIAre you sure about that?! Uncertainty Quantification in AI
Are you sure about that?! Uncertainty Quantification in AI
 
Why natural language is next step in the AI evolution
Why natural language is next step in the AI evolutionWhy natural language is next step in the AI evolution
Why natural language is next step in the AI evolution
 
WWDC 2019 Recap
WWDC 2019 RecapWWDC 2019 Recap
WWDC 2019 Recap
 
Network Policies
Network PoliciesNetwork Policies
Network Policies
 
Interpretable Machine Learning
Interpretable Machine LearningInterpretable Machine Learning
Interpretable Machine Learning
 
Jenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen UmgebungenJenkins X – CI/CD in wolkigen Umgebungen
Jenkins X – CI/CD in wolkigen Umgebungen
 
AI auf Edge-Geraeten
AI auf Edge-GeraetenAI auf Edge-Geraeten
AI auf Edge-Geraeten
 
Prometheus on Kubernetes
Prometheus on KubernetesPrometheus on Kubernetes
Prometheus on Kubernetes
 
Deep Learning for Recommender Systems
Deep Learning for Recommender SystemsDeep Learning for Recommender Systems
Deep Learning for Recommender Systems
 
Azure IoT Edge
Azure IoT EdgeAzure IoT Edge
Azure IoT Edge
 
Representation Learning von Zeitreihen
Representation Learning von ZeitreihenRepresentation Learning von Zeitreihen
Representation Learning von Zeitreihen
 
Talk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale AssistentenTalk to me – Chatbots und digitale Assistenten
Talk to me – Chatbots und digitale Assistenten
 
Künstlich intelligent?
Künstlich intelligent?Künstlich intelligent?
Künstlich intelligent?
 
Dev + Ops = Go
Dev + Ops = GoDev + Ops = Go
Dev + Ops = Go
 
Das Android Open Source Project
Das Android Open Source ProjectDas Android Open Source Project
Das Android Open Source Project
 
Machine Learning Interpretability
Machine Learning InterpretabilityMachine Learning Interpretability
Machine Learning Interpretability
 
Performance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use casePerformance evaluation of GANs in a semisupervised OCR use case
Performance evaluation of GANs in a semisupervised OCR use case
 
People & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madnessPeople & Products – Lessons learned from the daily IT madness
People & Products – Lessons learned from the daily IT madness
 
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with PulumiInfrastructure as (real) Code – Manage your K8s resources with Pulumi
Infrastructure as (real) Code – Manage your K8s resources with Pulumi
 

Hekaton & CSI Version 2 unter der Lupe

  • 1. SQL 2014 CTP1 Hekaton & CSI Version 2 unter der Lupe Sascha Götz Karlsruhe, 03. Dezember 2013
  • 2. 2 “Most of today’s database managers are built on the assumption that data lives on a disk, with little bits of data at a time loaded into memory for manipulation. There’s a whole lot of infrastructure involved in paging those subsets of data in and out[…]” - Kevin Farlee, SQL Server program manager, Microsoft - SQL 2014 CTP1 Hekaton – Memory optimized tables
  • 3. 3 Hekaton SQL 2014 CTP1 Hekaton – Memory optimized tables
  • 4. 4 SQL 2014 CTP1 Hekaton – Memory optimized tables SQL Server Memory Disk Query Cache File group Index Paging Memory-OptimizedDisk-Based Synchronisation Index Locking Disk (Memory Dump)
  • 5. 5 ‣ Filegroup hinzufügen ALTER DATABASE [AdventureWorksDW2012] ADD FILEGROUP [Hekaton_FG] CONTAINS MEMORY_OPTIMIZED_DATA GO ‣ Datafile hinzufügen ALTER DATABASE [AdventureWorksDW2012] ADD FILE ( NAME = N'Hekaton', FILENAME = N'C:Hekaton.ndf') TO FILEGROUP [Hekaton_FG] GO SQL 2014 CTP1 Hekaton – Memory optimized tables
  • 6. 6 CREATE TABLE [dbo].[FactInternetSales_Hekaton] ( [ProductKey] [int] NOT NULL, [OrderDateKey] [int] NOT NULL, [...], ) WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA) ‣ DURABILITY: ‣ SCHEMA_AND_DATA ‣ Schema und Daten werden mit Disk synchronisiert ‣ Speicherplatz wird im RAM und auf Disk benötigt ‣ SCHEMA_ONLY ‣ Nur Schema wird mit Disk synchronisiert SQL 2014 CTP1 Hekaton – Memory optimized tables
  • 7. 7 ‣ Natively Compiled Stored Procedure CREATE PROCEDURE <Schema_Name, sysname, dbo>.<Procedure_Name, sysname, Procedure_Name> -- Add the parameters for the stored procedure here […] WITH NATIVE_COMPILATION, SCHEMABINDING, EXECUTE AS OWNER AS BEGIN ATOMIC WITH --Insert statements for the stored procedure here […] END ‣ Nur Abfrage auf In-Memory Tabellen SQL 2014 CTP1 Hekaton – Memory optimized tables
  • 8. 8 ‣ Index ‣ Memory Optimized tables müssen mindestens einen Index haben (auf PK) ‣ Keine Clustered Indizes ‣ Indexe werden nur im Speicher gehalten ‣ Kein Index Drop, Rebuild ‣ Max. 8 Index pro Tabelle SQL 2014 CTP1 Hekaton – Memory optimized tables CI Date 1 11.11.13 2 12.11.13 3 13.11.13 4 14.11.13 5 15.11.13 6 16.11.13 7 17.11.13 Date 13.11.13 16.11.13 14.11.13 17.11.13 15.11.13 11.11.13 12.11.13 Non-CI 1 2 3 4 5 6 7 I1 I2 … I8 Date Order# … 3 6 13.11.13 98165 6 2 16.11.13 98121 4 1 14.11.13 98474 7 3 17.11.13 98521 5 4 15.11.13 98451 1 5 11.11.13 98514 2 7 12.11.13 98563
  • 9. 9 ‣ Limitations ‣ Keine Trigger ‣ Keine Foreign Key & Constraints ‣ Keine Identity columns ‣ Keine Schema changes (ALTER TABLE…) SQL 2014 CTP1 Hekaton – Memory optimized tables
  • 10. Demo
  • 11. 11 SQL 2014 CTP1 Hekaton – Memory optimized tables 40 4 20 1 0 5 10 15 20 25 30 35 40 45 Ohne Index Non-Clustered Index Aggregierung (SUM & Group BY) über 2 Mio Datensätze On-Disk In-Memory DauerinSekunden
  • 12. 12 SQL 2014 CTP1 Hekaton – Memory optimized tables 32 52 60 0 10 20 30 40 50 60 70 1 Update 2 Mio Datensätze On-Disk In-Memory In-Mermory + Natively Compiled DauerinSekunden
  • 13. 13 SQL 2014 CTP1 Hekaton – Memory optimized tables 13 17 0 2 4 6 8 10 12 14 16 18 1 1 Mio. Datensätze Load On-Disk In-Memory DauerinSekunden
  • 14. 14 ‣ Vorteile ‣ Performance ‣ Performance ‣ Performance ‣ Kritik ‣ Stabilität ‣ Speichermanagement ‣ Auslagerungs-Falle ‣ Fehlende Features (FKs, Identity Columns, Constraints) ‣ Bestehende Tabellen können nicht in die Hekaton Filegroup verschoben werden SQL 2014 CTP1 Hekaton – Memory optimized tables
  • 15. 15 ‣ Einsatzzweck ‣ DURABILITY: SCHEMA_ONLY ‣ ETL Load Tabelle ‣ Temp Tabellen ‣ DURABILITY: SCHEMA_AND_DATA ‣ Log-Tabellen SQL 2014 CTP1 Hekaton – Memory optimized tables
  • 16. 16 Columnstore Index 2 SQL 2014 CTP1 Columnstore Index
  • 17. 17 Non-Clustered Columnstore Index (SQL Server 2012) • (+) Performance • (+) Easy-To-Use • (-) Read-Only Clustered Columnstore Index (SQL Server 2014 CTP 1) • (+) Performance • (+) Easy-To-Use • (+) Updateable • (-) Keine PK & FK • (-) Keine Constraints SQL 2014 CTP1 Columnstore Index
  • 18. 18 106 71 9 1 0 20 40 60 80 100 120 1 Aggregierung (SUM & Group BY) über 25 Mio Datensätze Ohne Index Non-Clustered Index Non-Clustered Columnstore Index Clustered Columnstore Index SQL 2014 CTP1 Columnstore Index DauerinSekunden
  • 19. 19 SQL 2014 CTP1 Columnstore Index 20 23 27 0 5 10 15 20 25 30 1 Mio. Datensätze Load Ohne Index Non-Clustered Index Non-Clustered Columnstore Index Clustered Columnstore Index Nichtmöglich DauerinSekunden
  • 20. Szenario: 25 Mio Datensätze, Non-Clustered CSI, 1 Mio Datensätze Load 20 ‣ Daten doch Laden bei Non-Clustered Columnstore Index? ‣ Drop, Load and Rebuild ‣ Partition Swap SQL 2014 CTP1 4 20 103 1 20 5 1 Columnstore Index Split Load Build Swap Drop Load Build
  • 21. ‣ HowTo: Partition Swapping ‣ Tabelle partitionieren ‣ Leere Partitionen ‣ Load in Temp laden ‣ Partition Split ‣ CSI Index erstellen ‣ Switch 21 SQL 2014 CTP1 Columnstore Index <2011 2011 2012 2013 >2013 Facts 2011-2013 CSI >2014 2014 2014
  • 22. 22 SQL 2014 CTP1 Columnstore Index 20 23 127 27 27 0 20 40 60 80 100 120 140 1 Mio. Datensätze Load Ohne Index Non-Clustered Index Non-Clustered CSI Non-Clustered CSI2 Clustered Columnstore Index Partition Swap Drop&Rebuild DauerinSekunden
  • 23. 23 ‣ Fazit ‣ Query-Performance: Gigantisch ‣ Load-Performance: Mäßig bis Schlecht ‣ Nachteile: Vorhanden ‣ Einsatzzweck: ‣ Non-Clustered CSI ‣ BI Fact tables mit daily/nightly Loads ‣ Partition Swap oder Index Rebuild ‣ Clustered CSI ‣ Log Tabellen ‣ ‚Solo‘-Tabellen (ohne PK /FK) SQL 2014 CTP1 Columnstore Index
  • 25. 25 ‣ SQL Server Hekaton CTP1 White Paper http://download.microsoft.com/download/F/5/0/F5096A71-3C31-4E9F-864E- A6D097A64805/SQL_Server_Hekaton_CTP1_White_Paper.pdf ‣ http://blogs.msdn.com/b/arvindsh/archive/2013/07/03/sql-2014-in-memory-oltp- hekaton-training-videos-and-white-papers.aspx ‣ http://www.databasejournal.com/features/mssql/new-enhanced-column-store- index-in-sql-server-2014-part-1.html ‣ http://rusanu.com/2011/07/13/how-to-update-a-table-with-a-columnstore-index/ SQL 2014 CTP1 Ressources