Top 5 Things You Didn't Know About InMemory OLTP Your company logo here Vinod Kumar M @vinodk_sql http://blogs.ExtremeExperts.com 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 What is In-Memory OLTP? • SQL Server 2014 adds in-memory technology to boost performance of OLTP workloads Create Table DDL CREATE 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); Hash Index Secondary Indexes are specified inline This table is memory optimized This table is durable Memory Optimized Table Creation Create Table DDL Code generation and compilation Table DLL produced Table DLL loaded UNDERSTANDING HASH INDEXES Hash Indexes Hash function f: Hash index with (bucket_count=8): Hash mapping: Array of 8-byte Memory pointers f(Pinal) f(Vinod) f(Lakhani) 0 1 2 3 4 5 6 7 f(MP) f(KAR) f(CHENNAI) • Maps values to buckets • Built into the system Hash Collisions Memory Optimized Tables and Indexes Timestamps Chain ptrs Hash index on Name f(Pinal) 50, ∞ Name City Hash index on City Pinal BLR f(BLR) f(Vinod) f(Chennai) 90, ∞ Vinod Chennai Memory Optimized Tables and Indexes Timestamps Chain ptrs Hash index on Name f(Balu) 50, ∞ Name City Hash index on City Pinal BLR f(BLR) 100, ∞ Balu BLR 90, ∞ Vinod Chennai T100: INSERT (Balu, BLR) Memory Optimized Tables and Indexes Timestamps Chain ptrs Hash index on Name 50, ∞ Name City Hash index on City Pinal BLR 100, ∞ Balu BLR 90, 150 Vinod Chennai T150: DELETE (Vinod, Chennai) Memory Optimized Tables and Indexes Timestamps Chain ptrs Hash index on Name f(Balu) 50, ∞ 100,200 ∞ 100, Name City Hash index on City Pinal Balu BLR BLR f(Chennai) 200, ∞ 90, 150 Balu Vinod Chennai Chennai T200: UPDATE (Balu, BLR) to (Balu, Chennai) Memory Optimized Tables and Indexes Timestamps Chain ptrs Hash index on Name f(Pinal) 50, ∞ Name City Hash index on City Pinal BLR f(BLR) f(Balu) 100, 200 Balu BLR f(Chennnai) 200, ∞ 90, 150 Balu Vinod Chennai Chennai T250: Garbage collection HOW INMEMORY PROCEDURES ARE CREATED !!! Procedure Creation CREATE PROC DDL Query optimization Code generation and compilation Procedure DLL produced Procedure DLL loaded 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 memoryoptimized log records transparently • Not supported – Differential backup QUESTION
© Copyright 2024