18
Top 5 Things You Didn't Know About InMemory OLTP Vinod Kumar M @vinodk_sql http://blogs.ExtremeExperts.com Your company logo here

Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Top 5 Things You Didn't Know About InMemory OLTP

Vinod Kumar M

@vinodk_sql

http://blogs.ExtremeExperts.com

Your

company

logo here

Page 2: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Myths about In-Memory OLTP

• SQL Server In-Memory OLTP is a recent

response to competitors’ offerings

• In-Memory OLTP is like DBCC PINTABLE

• In-Memory Databases are new separate products

• You can use In-Memory OLTP in an existing SQL

Server app with NO changes whatsoever

• Since tables are in memory, the data is not

Durable or Highly Available – I will lose it after

server crash

Page 3: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response
Page 4: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

What is In-Memory OLTP?• SQL Server 2014 adds in-memory technology to boost performance of OLTP workloads

Page 5: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Create Table DDLCREATE TABLE [Customer](

[CustomerID] INT NOT NULL

PRIMARY KEY NONCLUSTERED HASH WITH (BUCKET_COUNT = 1000000),

[Name] NVARCHAR(250) NOT NULL

INDEX [IName] HASH WITH (BUCKET_COUNT = 1000000),

[CustomerSince] DATETIME NULL

)

WITH (MEMORY_OPTIMIZED = ON, DURABILITY = SCHEMA_AND_DATA);

This table is memory optimized This table is durable

Secondary Indexes are

specified inline

Hash Index

Page 6: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Memory Optimized Table Creation

Create Table DDL

Code generation and compilation

Table DLL produced

Table DLL loaded

Page 7: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

UNDERSTANDING HASH INDEXES

Page 8: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Hash Indexes

4567

0123

Array of

8-byte

Memory

pointers

Hash index with (bucket_count=8): Hash function f:• Maps values to buckets

• Built into the systemHash mapping:

f(Lakhani)

f(Vinod)f(Pinal)

f(MP)

f(CHENNAI)

Hash

Collisionsf(KAR)

Page 9: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Memory Optimized Tables and Indexes

50, ∞ Pinal BLR

Timestamps NameChain ptrs City

Hash index

on CityHash index

on Name

90, ∞ Vinod Chennai

f(Pinal)

f(Vinod)

f(BLR)

f(Chennai)

Page 10: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Memory Optimized Tables and Indexes

50, ∞ Pinal BLR

Timestamps NameChain ptrs City

Hash index

on CityHash index

on Name

T100: INSERT (Balu, BLR)

100, ∞ Balu BLR

90, ∞ Vinod Chennai

f(Balu) f(BLR)

Page 11: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

90, 150 Vinod Chennai

Memory Optimized Tables and Indexes

50, ∞ Pinal BLR

Timestamps NameChain ptrs City

Hash index

on CityHash index

on Name

T150: DELETE (Vinod, Chennai)

100, ∞ Balu BLR

Page 12: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Memory Optimized Tables and Indexes

90, 150 Vinod Chennai

50, ∞ Pinal BLR

Timestamps NameChain ptrs City

Hash index

on CityHash index

on Name

T200: UPDATE

(Balu, BLR) to

(Balu, Chennai)

100, ∞ Balu BLR

200, ∞ Balu Chennai

100, 200

f(Chennai)

f(Balu)

Page 13: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Memory Optimized Tables and Indexes

90, 150 Vinod Chennai

50, ∞ Pinal BLR

Timestamps NameChain ptrs City

Hash index

on CityHash index

on Name

T250: Garbage collection

100, 200 Balu BLR

200, ∞ Balu Chennai

f(Balu)

f(Pinal)

f(Chennnai)

f(BLR)

Page 14: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

HOW INMEMORY PROCEDURES ARE CREATED !!!

Page 15: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Procedure Creation

CREATE PROC DDL

Query optimization

Code generation and compilation

Procedure DLL produced

Procedure DLL loaded

Page 16: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

Backup for Memory-Optimized Tables

• Integrated with SQL Database Backup

– Memory-Optimized file group is backed up

as part SQL database backup

• Existing backup scripts work with minimal or

no changes

• Transaction log backup includes memory-

optimized log records transparently

• Not supported

– Differential backup

Page 17: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response

QUESTION

Page 18: Top 5 Things You Didn't Know About InMemory OLTPdevelopermarch.com/developersummit/2015/report/download...Myths about In-Memory OLTP •SQL Server In-Memory OLTP is a recent response