by Niko Neugebauer
• PASS Evangelist
• SQL Server MVP
• SQLPort ( http://www.sqlport.com
) founder & leader
• BITuga ( http://www.bituga.pt
) co-founder
• 15+ years in IT
HEK-A-TON, HEK-A-TON, HEK-A-TON
• ἑκατόν – means 100 in Greek
• Targeted to improve OLTP performance, 100 Times
• Imagine that you have a number of CPU steps to perform a typical OLTP action
• Optimize it 100 times by removing obstacles like latches and parallelize it
• Yes, you will need start from the bottom and from the very beginning?
• Look at the CPU speed increase
• Look at the Memory Prices
• You can’t buy a SQL Server Enterprise License for a price of a TB
• Think, think, think
Hekaton
Sybase SQL Server 1.0
• 1980 (1989)
• Hardware Expensive
• CPU Bound
• Pages 8K
SQL Server 11.0
• 2012
• Hardware Cheap
• IO & Memory Bound
• Pages 8K
• In-Memory Database
• Multi-Core Awareness and Optimizations
• xVelocity compression algorithm (hint: ColumnStore)
• No Pages (no more splits, allocations, etc)
• No Locks, No Latches + different Concurrency Control
• StreamInsight (no more 8K’s)
• Hash Index (no more b-trees)
• Existing T-SQL can be reused
• Highly scalable concurrency control mechanism
• Lock-free data structures
• ACID compliant
• Optimized for extreme Transaction Processing scenarios like
• Financial Services
• Online Gambling
• There are customers who are using it NOW
Hekaton
• Snapshot_Isolation ONLY
• No support for LOB data types
• No Triggers
• AlwaysOn Support
• Durable Tables
• Non-Durable Tables
• TempDB is used inside of the Hekaton, in-memory
• Shares memory with Buffer Pool, but has its own space
• Different space allocation for memory buffer
• The very same transaction log, but with fewer writes
• Different filegroups
• Different treatment for Indexes
• A lot of new, different stuff
It actually looks like a …
• Create table dbo.Hekaton(
• Id int primary key hash with (bucketcount = 65535),
• Nome varchar(50)
) WITH (MEMORY_OPTIMIZED = ON, DURABILITY
= SCHEMA_AND_DATA );
GO
Stored Procs:
• Uses C as internal intermediate presentation, and then compiles into native code
• Atomic blocks
• Can’t reference non-hekaton tables
• Create procedure dbo.HekatonNow
• WITH NATIVE_COMPILATION
BEGIN
END
GO select name from dbo.Hekaton;
• Uses StreamInsight
• No actual updates, but deletes & inserts
• Migration from the normal DB tables to Hekaton
• Stored Procedures Migration to Hekaton
Next major version of SQL Server
• Isn’t it too fast ?
• – No, there is no such concept as too fast. (as long as it does not create other problems)