SlideShare a Scribd company logo
An introduction to 
SQL Server In-Memory OLTP 
Krishnakumar S
Traditional OLTP Architecture 
•Disk is cheap – Data lives in disk 
•Memory is fast – Data modified in memory (Buffer) 
•Disk to Memory – I/O utilization 
•Query processing – CPU & Memory utilization 
•ACID – I/O utilization 
Write ahead log, Transaction Log 
CPU utilization (Locking, latching) 
•Memory to Disk – I/O utilization 
(Dirty pages to disk – Checkpoint)
Traditional OLTP Architecture 
High volume data modifications 
Contentions – “Competition for resources” 
•Lock 
•Latch 
•Disk I/O 
•Allocation 
Airlines 
Sensor data 
Application logging 
Conversations 
etc…
Changing scenario….. 
CPU vs. Memory vs. I/O 
“The Free lunch is over…” – Herb Sutter, Dr. Dobb’s Journal, March 2005 
CPU 
Still hold Moor’s law 
Becoming faster 
Multicore 
Memory 
Getting cheaper 
Becoming faster 
Hold more data 
I/O 
Lagging far behind 
CPU and Memory 
“Tape is dead Disk is Tape Flash is Disk…” – Jim Gray, Microsoft, Dec 2006
SQL Server 2014 In-memory OLTP Engine 
Goal was to achieve 100x speedup for certain TP operations 
Hekaton a Greek word for 100 
Microsoft spend nearly seven years on Hekaton 
A major change in SQL Server engine from version 7.0
SQL Server 2014 In-memory OLTP Engine 
Four architectural pillars 
1. Optimize for main memory data access 
2. Accelerate business logic processing 
3. Provide frictionless scale-up 
4. Built-in to SQL Server
SQL Server 2014 In-memory OLTP Engine 
Optimize for main memory 
1. No 8KB pages for tables; only stream of bytes 
2. New lock and latch free in-memory indexes 
1. Hash index (equality) 
2. Bw index (range) [“Buzz Word” index] 
3. Using MVCC (Muti-Version Concurrency 
control); transactions see a snapshot of data 
4. Log, data changes to transaction log 
5. No logging for index changes; recreates when 
server restart
SQL Server 2014 In-memory OLTP Engine 
Accelerate business logic processing 
1. Table and index metadata compiled to DLL 
1. Table row format preserved in DLL 
2. Traditional query engine can be leveraged to access in-memory 
tables 
2. Stored Procedure compiled to DLL
SQL Server 2014 In-memory OLTP Engine 
Frictionless scale-up 
1. Multi-version optimistic concurrency control with ACID 
support 
2. Lock free algorithms for in-memory engine 
3. No lock manager, latches or spin lock
SQL Server 2014 In-memory OLTP Engine 
Built-in to SQL Server 
1. In-memory engine is integrated in to SQL Server 
2. Both memory optimized and traditional tables can be 
created for a database 
3. No lock manager, latches or spin lock
In-memory OLTP Engine – Behind the scenes
In-memory OLTP Engine – Behind the scenes 
Rows 
• Row Header 
– BeginTS 
• TX TS that created the row 
– EndTS 
• TX TS that deleted the row 
• Infinity 
– StmtID 
• Statement that created the row 
– IdxLinkCount 
• Number of indexes that reference this row 
• Payload = actual data 
TxID global DB counter 
Reset on restart 
Incremented on TX 
start 
TxTimeStamp global DB 
counter 
Not reset on restart 
Incremented on TX 
end
In-memory OLTP Engine – Behind the scenes 
Rows – Hash index 
Hash index 
on Name 
f(John) 
Transaction 99: 
SELECT City WHERE Name = ‘John’ 
Simple hash lookup returns direct pointer to ‘John’ row 
50, 100 
50, ∞ John Paris 
100, ∞ John Prague 
90, ∞ Susan Bogota 
Timestamps Chain ptrs Name City 
Transaction 100: 
UPDATE City = ‘Prague’ where 
Name = ‘John’ 
No locks of any kind, no 
interference with transaction 99
In-memory OLTP Engine – Behind the scenes 
Rows – Non clustered index
In-memory OLTP Engine – Behind the scenes 
Rows – Non clustered index 
Page Mapping Table 
Addr. 
0 
1 
2 
3 
4 
… 
Δ Deleted record 48 Delta record 
Δ Inserted Record 50 
Page P 
Delta record 
PID 
0 
1 
2 
3 
4 
… 
4.21
In-memory OLTP Engine – Summary 
• T-SQL Features 
– 2 ways to access in-memory tables 
• T-SQL interop (usually slower) 
• Natively compiled stored procedures (fast) 
• T-SQL non supported features 
– TRUNCATE Table 
– MERGE (when in-memory table is the target) 
– Linked servers 
– Locking hints: TABLOCK, XLOCK, PAGLOCK, etc. 
• NOLOCK is supported, but is quietly ignored
In-memory OLTP Engine – Summary 
• Stored Procedures 
– TRY, CATCH, error functions, IF, WHILE 
– Memory-optimized table types and table variables 
– Math, Date, String functions 
– SCOPE_IDENTITY, ISNULL, NEWID, 
NEWSEQUENTIALID
In-memory OLTP Engine – Summary 
• Common Design patterns 
– In-Memory OLTP 
– High-performance OLTP 
– High data input or ”Shock Absorber” 
– Relational cache 
– Read-scale 
– ETL target and staging/temp tables
Demo
Questions?
Thank You

More Related Content

What's hot (20)

PDF
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
anandology
 
PDF
TokuDB 高科扩展性 MySQL 和 MariaDB 数据库
YUCHENG HU
 
PDF
MySQL 5.6 Performance
MYXPLAIN
 
PPTX
Overview of some popular distributed databases
sagar chaturvedi
 
PPTX
In memory databases presentation
Michael Keane
 
PPTX
Sql server 2016 it just runs faster sql bits 2017 edition
Bob Ward
 
PDF
TokuDB internals / Лесин Владислав (Percona)
Ontico
 
PDF
What's New In PostgreSQL 9.4
Pavan Deolasee
 
PDF
Migration challenges and process
Andrejs Vorobjovs
 
PDF
Bn 1016 demo postgre sql-online-training
conline training
 
PDF
PostgreSQL and MySQL
PostgreSQL Experts, Inc.
 
PDF
InnoDB Architecture and Performance Optimization, Peter Zaitsev
Fuenteovejuna
 
PPTX
Experience sql server on l inux and docker
Bob Ward
 
PDF
TokuDB - What You Need to Know
Jervin Real
 
PPTX
Get More Out of MongoDB with TokuMX
Tim Callaghan
 
PDF
M|18 How to use MyRocks with MariaDB Server
MariaDB plc
 
PPTX
Designing enterprise drupal
Jason Burnett
 
PPTX
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
Bob Ward
 
PPTX
Some key value stores using log-structure
Zhichao Liang
 
PPTX
When is MyRocks good?
Alkin Tezuysal
 
Ten Reasons Why You Should Prefer PostgreSQL to MySQL
anandology
 
TokuDB 高科扩展性 MySQL 和 MariaDB 数据库
YUCHENG HU
 
MySQL 5.6 Performance
MYXPLAIN
 
Overview of some popular distributed databases
sagar chaturvedi
 
In memory databases presentation
Michael Keane
 
Sql server 2016 it just runs faster sql bits 2017 edition
Bob Ward
 
TokuDB internals / Лесин Владислав (Percona)
Ontico
 
What's New In PostgreSQL 9.4
Pavan Deolasee
 
Migration challenges and process
Andrejs Vorobjovs
 
Bn 1016 demo postgre sql-online-training
conline training
 
PostgreSQL and MySQL
PostgreSQL Experts, Inc.
 
InnoDB Architecture and Performance Optimization, Peter Zaitsev
Fuenteovejuna
 
Experience sql server on l inux and docker
Bob Ward
 
TokuDB - What You Need to Know
Jervin Real
 
Get More Out of MongoDB with TokuMX
Tim Callaghan
 
M|18 How to use MyRocks with MariaDB Server
MariaDB plc
 
Designing enterprise drupal
Jason Burnett
 
SQL Server In-Memory OLTP: What Every SQL Professional Should Know
Bob Ward
 
Some key value stores using log-structure
Zhichao Liang
 
When is MyRocks good?
Alkin Tezuysal
 

Viewers also liked (19)

PPSX
Microsoft Hekaton
Siraj Memon
 
PPTX
Query Store and live Query Statistics
SolidQ
 
PPTX
sql_server_2016_history_tables
arthurjosemberg
 
PPTX
Back to the future - Temporal Table in SQL Server 2016
Stéphane Fréchette
 
PPTX
Always encrypted overview
SolidQ
 
PPTX
Stretch Database
SolidQ
 
PPTX
Row-level security and Dynamic Data Masking
SolidQ
 
PDF
SQL Server 2016 Editions
Onomi
 
PDF
Live Query Statistics & Query Store in SQL Server 2016
Antonios Chatzipavlis
 
PDF
Travelling in time with SQL Server 2016 - Damian Widera
ITCamp
 
PPTX
Temporal Snapshot Fact Tables
Davide Mauri
 
PDF
Live Presentation Transformation From Boring to Effective - Boris Hristov
ITCamp
 
PPTX
High Availability & Disaster Recovery with SQL Server 2012 AlwaysOn Availabil...
turgaysahtiyan
 
PPTX
SQL 2016 Mejoras en InMemory OLTP y Column Store Index
Eduardo Castro
 
PPTX
SQL Saturday 510 Paris 2016 - Query Store session - final
Philippe Geiger
 
PPTX
SQL Server It Just Runs Faster
Bob Ward
 
PPTX
Otimizando a performance com in memory no sql 2016
Luiz Henrique Garetti Rosário
 
PPTX
Inside SQL Server In-Memory OLTP
Bob Ward
 
PDF
Ssis 2016 RC3
MSDEVMTL
 
Microsoft Hekaton
Siraj Memon
 
Query Store and live Query Statistics
SolidQ
 
sql_server_2016_history_tables
arthurjosemberg
 
Back to the future - Temporal Table in SQL Server 2016
Stéphane Fréchette
 
Always encrypted overview
SolidQ
 
Stretch Database
SolidQ
 
Row-level security and Dynamic Data Masking
SolidQ
 
SQL Server 2016 Editions
Onomi
 
Live Query Statistics & Query Store in SQL Server 2016
Antonios Chatzipavlis
 
Travelling in time with SQL Server 2016 - Damian Widera
ITCamp
 
Temporal Snapshot Fact Tables
Davide Mauri
 
Live Presentation Transformation From Boring to Effective - Boris Hristov
ITCamp
 
High Availability & Disaster Recovery with SQL Server 2012 AlwaysOn Availabil...
turgaysahtiyan
 
SQL 2016 Mejoras en InMemory OLTP y Column Store Index
Eduardo Castro
 
SQL Saturday 510 Paris 2016 - Query Store session - final
Philippe Geiger
 
SQL Server It Just Runs Faster
Bob Ward
 
Otimizando a performance com in memory no sql 2016
Luiz Henrique Garetti Rosário
 
Inside SQL Server In-Memory OLTP
Bob Ward
 
Ssis 2016 RC3
MSDEVMTL
 
Ad

Similar to An introduction to SQL Server in-memory OLTP Engine (20)

PPTX
Novedades SQL Server 2014
netmind
 
PDF
SQL Server 2014 Mission Critical Performance - Level 300 Presentation
David J Rosenthal
 
PPTX
Hekaton introduction for .Net developers
Shy Engelberg
 
PDF
SQL Server Internals In Memory OLTP Inside the SQL Server 2016 Hekaton Engine...
nofalgrethat
 
PPTX
SQL Server 2014 Memory Optimised Tables - Advanced
Tony Rogerson
 
PDF
SQL Server 2014 In-Memory Tables (XTP, Hekaton)
Tony Rogerson
 
PDF
SQL Server 2016 novelties
MSDEVMTL
 
PPTX
Geek Sync I Need for Speed: In-Memory Databases in Oracle and SQL Server
IDERA Software
 
PDF
Sql2017 in memory oltp for developers
Rico Chen
 
PPTX
SQL Server 2014 Extreme Transaction Processing (Hekaton) - Basics
Tony Rogerson
 
PDF
Microsoft SQL Server 2014 in memory oltp tdm white paper
David J Rosenthal
 
PPT
Performance dreams of sql server 2014
Shehap Elnagar
 
PPTX
In Memory OLTP
BT Akademi
 
PPTX
Oracle Database in-Memory Overivew
Maria Colgan
 
PPTX
SQL server 2016 New Features
Amin Mesbahi
 
PPTX
SQL Server In-Memory OLTP Migration Overview
Jose Rivera Miranda
 
PDF
In Memory Database In Action by Tanel Poder and Kerry Osborne
Enkitec
 
PDF
Oracle Database In-Memory Option in Action
Tanel Poder
 
PPTX
SQL 2014 In-Memory OLTP
Amber Keyse
 
PDF
In-memory ColumnStore Index
SolidQ
 
Novedades SQL Server 2014
netmind
 
SQL Server 2014 Mission Critical Performance - Level 300 Presentation
David J Rosenthal
 
Hekaton introduction for .Net developers
Shy Engelberg
 
SQL Server Internals In Memory OLTP Inside the SQL Server 2016 Hekaton Engine...
nofalgrethat
 
SQL Server 2014 Memory Optimised Tables - Advanced
Tony Rogerson
 
SQL Server 2014 In-Memory Tables (XTP, Hekaton)
Tony Rogerson
 
SQL Server 2016 novelties
MSDEVMTL
 
Geek Sync I Need for Speed: In-Memory Databases in Oracle and SQL Server
IDERA Software
 
Sql2017 in memory oltp for developers
Rico Chen
 
SQL Server 2014 Extreme Transaction Processing (Hekaton) - Basics
Tony Rogerson
 
Microsoft SQL Server 2014 in memory oltp tdm white paper
David J Rosenthal
 
Performance dreams of sql server 2014
Shehap Elnagar
 
In Memory OLTP
BT Akademi
 
Oracle Database in-Memory Overivew
Maria Colgan
 
SQL server 2016 New Features
Amin Mesbahi
 
SQL Server In-Memory OLTP Migration Overview
Jose Rivera Miranda
 
In Memory Database In Action by Tanel Poder and Kerry Osborne
Enkitec
 
Oracle Database In-Memory Option in Action
Tanel Poder
 
SQL 2014 In-Memory OLTP
Amber Keyse
 
In-memory ColumnStore Index
SolidQ
 
Ad

Recently uploaded (20)

PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Digital Circuits, important subject in CS
contactparinay1
 

An introduction to SQL Server in-memory OLTP Engine

  • 1. An introduction to SQL Server In-Memory OLTP Krishnakumar S
  • 2. Traditional OLTP Architecture •Disk is cheap – Data lives in disk •Memory is fast – Data modified in memory (Buffer) •Disk to Memory – I/O utilization •Query processing – CPU & Memory utilization •ACID – I/O utilization Write ahead log, Transaction Log CPU utilization (Locking, latching) •Memory to Disk – I/O utilization (Dirty pages to disk – Checkpoint)
  • 3. Traditional OLTP Architecture High volume data modifications Contentions – “Competition for resources” •Lock •Latch •Disk I/O •Allocation Airlines Sensor data Application logging Conversations etc…
  • 4. Changing scenario….. CPU vs. Memory vs. I/O “The Free lunch is over…” – Herb Sutter, Dr. Dobb’s Journal, March 2005 CPU Still hold Moor’s law Becoming faster Multicore Memory Getting cheaper Becoming faster Hold more data I/O Lagging far behind CPU and Memory “Tape is dead Disk is Tape Flash is Disk…” – Jim Gray, Microsoft, Dec 2006
  • 5. SQL Server 2014 In-memory OLTP Engine Goal was to achieve 100x speedup for certain TP operations Hekaton a Greek word for 100 Microsoft spend nearly seven years on Hekaton A major change in SQL Server engine from version 7.0
  • 6. SQL Server 2014 In-memory OLTP Engine Four architectural pillars 1. Optimize for main memory data access 2. Accelerate business logic processing 3. Provide frictionless scale-up 4. Built-in to SQL Server
  • 7. SQL Server 2014 In-memory OLTP Engine Optimize for main memory 1. No 8KB pages for tables; only stream of bytes 2. New lock and latch free in-memory indexes 1. Hash index (equality) 2. Bw index (range) [“Buzz Word” index] 3. Using MVCC (Muti-Version Concurrency control); transactions see a snapshot of data 4. Log, data changes to transaction log 5. No logging for index changes; recreates when server restart
  • 8. SQL Server 2014 In-memory OLTP Engine Accelerate business logic processing 1. Table and index metadata compiled to DLL 1. Table row format preserved in DLL 2. Traditional query engine can be leveraged to access in-memory tables 2. Stored Procedure compiled to DLL
  • 9. SQL Server 2014 In-memory OLTP Engine Frictionless scale-up 1. Multi-version optimistic concurrency control with ACID support 2. Lock free algorithms for in-memory engine 3. No lock manager, latches or spin lock
  • 10. SQL Server 2014 In-memory OLTP Engine Built-in to SQL Server 1. In-memory engine is integrated in to SQL Server 2. Both memory optimized and traditional tables can be created for a database 3. No lock manager, latches or spin lock
  • 11. In-memory OLTP Engine – Behind the scenes
  • 12. In-memory OLTP Engine – Behind the scenes Rows • Row Header – BeginTS • TX TS that created the row – EndTS • TX TS that deleted the row • Infinity – StmtID • Statement that created the row – IdxLinkCount • Number of indexes that reference this row • Payload = actual data TxID global DB counter Reset on restart Incremented on TX start TxTimeStamp global DB counter Not reset on restart Incremented on TX end
  • 13. In-memory OLTP Engine – Behind the scenes Rows – Hash index Hash index on Name f(John) Transaction 99: SELECT City WHERE Name = ‘John’ Simple hash lookup returns direct pointer to ‘John’ row 50, 100 50, ∞ John Paris 100, ∞ John Prague 90, ∞ Susan Bogota Timestamps Chain ptrs Name City Transaction 100: UPDATE City = ‘Prague’ where Name = ‘John’ No locks of any kind, no interference with transaction 99
  • 14. In-memory OLTP Engine – Behind the scenes Rows – Non clustered index
  • 15. In-memory OLTP Engine – Behind the scenes Rows – Non clustered index Page Mapping Table Addr. 0 1 2 3 4 … Δ Deleted record 48 Delta record Δ Inserted Record 50 Page P Delta record PID 0 1 2 3 4 … 4.21
  • 16. In-memory OLTP Engine – Summary • T-SQL Features – 2 ways to access in-memory tables • T-SQL interop (usually slower) • Natively compiled stored procedures (fast) • T-SQL non supported features – TRUNCATE Table – MERGE (when in-memory table is the target) – Linked servers – Locking hints: TABLOCK, XLOCK, PAGLOCK, etc. • NOLOCK is supported, but is quietly ignored
  • 17. In-memory OLTP Engine – Summary • Stored Procedures – TRY, CATCH, error functions, IF, WHILE – Memory-optimized table types and table variables – Math, Date, String functions – SCOPE_IDENTITY, ISNULL, NEWID, NEWSEQUENTIALID
  • 18. In-memory OLTP Engine – Summary • Common Design patterns – In-Memory OLTP – High-performance OLTP – High data input or ”Shock Absorber” – Relational cache – Read-scale – ETL target and staging/temp tables
  • 19. Demo