SlideShare a Scribd company logo
1 of 32
Download to read offline
SQL Server 2014
In-Memory Tables

(Extreme Transaction Processing)
Tony Rogerson, SQL Server MVP
@tonyrogerson
tonyrogerson@torver.net
http://dataidol.com/tonyrogerson
Who am I?
Freelance SQL Server professional and Data Specialist
Started out in 1986 – DB2, Oracle, SQL Server since 4.21a
SQL Server MVP since 97
Fellow BCS, MSc in BI, studying for Data Science PGCert
Allotment holder – onions and garlic were rubbish this year

Interested in Data Science especially commodity based distributed processing
(NoSanMan!)
Agenda
What’s an in-Memory database?
SQL Server in-Memory technologies – OLAP and OLTP
Getting Started with Hekaton
Implementation ideas and moving forward
In-Memory Database/Table?
In-Memory Landscape (Nov 2013 – a small section!)
Oracle – TimesTen (embedded into DB Cache, Exalytics)
SAP – HANA
IBM solidDB
SQL Server xVelocity (next generation of Vertipaq) – Column Store
SQL Server Hekaton (for OLTP – relational type workloads)

Database Cache OR proper in-Memory database
Entire DB in memory / Selected tables (mix with stable storage)
SQL Server in-Memory OLAP / OLTP
Column Store (xVelocity - used to be called Vertipaq)
Column Store Indexing (read only)
New “CLUSTERED” column store index allowing ins/del/upd
Really in-memory or just compression?
In-Memory Tables (Hekaton) – Extreme Transaction Processing (XTP)
Geared to new storage paradigm of Flash and multi-core machines
Memory and Flash optimised with new Bw-Tree (Buzz Word Tree) and Hash indexing
Natively Compiled Stored Procedures
Join in-memory data with legacy B-Tree/Heap on stable storage
Allows us to remove the need for Durability (hoorah!)
StreamInsight – Complex Events Processing
Getting Started with Hekaton
Database composition
Hash Indexes – B+Tree or BW-Tree
Durability [or not] – Transaction Logging
Isolation
Interop or Native in-Memory

Native Compilation
Database Composition
1 File Group,
1 or More files
Storage (Database Start Up)
Memory
RAW DATA
on Storage
(no index data)

Raw
Data

Build
Bw-Tree

Queryable

Uses File-Stream

Data loaded, indexes built on Database recovery
Make sure the IO Sub-system can handle the load – it will swamp the IO’s
Offline CHECKPOINT saves tables SCHEMA_AND_DATA durability to File-Stream
(storage)
File Stream
Normal tables:
Bulked up IO through lazywriter
{over}-Writes are to set database structure
Random IO causes latency issues
Blocked IO causes Flash wear
XTP:
Writes append to multiple 128MiB files
No need to write Index changes or internal structures
Just need the delta’s for recovery
Use multiple files on the in-memory file group for performance
Balance – Buffer Pool v XTP
XTP competes with the Buffer Pool
Use Resource Pool to limit XTP
Base resource pool memory on the minimum requirement
Versioning needs to be considered – multiple versions of the row!
DEMO #1 - DB
CREATEDB.sql
New Index types
HASH index – for expressions of equality
Hash of the index (key) columns – no DRI
If it can’t seek it will scan – scan everything!
Range index – for everything else
Bw(Buzz Word)-Tree
Derivative of the B+Tree but
Elastic page sizes
No update – updates through versioning and processing the delta’s on commit
Hash indexing
Array [Mapping Table] of cells [Hash Buckets]
Eg. {CHECKSUM( “Jen Stirrup” ), CHECKSUM( “Anthony Saxby” )}
Hash collision forms a chain of rows (1 bucket has a row chain – rows sharing same hash)
Reduce hash collisions by increasing the BUCKET_COUNT
Ideal is BUCKET_COUNT = number of unique values x2 (depends on hash collisions too)
Buckets use memory
Careful on composite keys – the complete key is hashed making part lookups unable to use
the index.
Character data-type required to be Latin1_General_100_BIN2
@ Database level
@ Column Level e.g. avarchar varchar(50) COLLATE Latin1_General_100_BIN2 not null
Hash
Bucket
#

Hash Index

Pointer
(64bit)

0

Null

123

//

//

122

Hash
Function

1

Null
12312

124

LP13 VSF

HASH

123

NaturalKey

Null

Null

Range 0 – 150,000

//

150000

NaturalKey

DateRegistered

Make

Colour

Memory
Location

AA13 SAE

2013-01-01

Ford

Red

0

LP13 VSF

2013-05-01

Volkswagen

Blue

12312

Null
Hash
Bucket
#

Hash Index - Usage

Pointer
(64bit)

1

Null
//
Null

123

12312

124

Range 0 – 150,000

Null

//

123

0

122

WHERE NaturalKey = ‘LP13 VSF’

HASH

Hash
Function

Null

//

150000

NaturalKey

DateRegistered

Make

Colour

Memory
Location

AA13 SAE

2013-01-01

Ford

Red

0

LP13 VSF

2013-05-01

Volkswagen

Blue

12312

Null
Hash Index – Range expressions
Hash [seek] is an equality / inequality only operation
WHERE NaturalKey > ‘LP13 VSF’ makes no sense
WHERE Hash(NaturalKey) > Hash( ‘LP13 VSF’ )
WHERE 123 > 123

WHERE HASH( NaturalKey [a..e] ) > HASH( ‘a’ )
Hash Index (reality)
Hash
Bucket
#

Pointer
(64bit)

0

Null

1

Null

//

//

122

NaturalKey

DateRegistered

Make

Colour

Memory Begin/End
Location Timestamp

LP13 VSF

2013-05-01

Volkswagen

Blue

12312

KK10 SED

2010-05-01

Ford

Green

12355

Null

LP13 VSF

2013-05-01

Volkswagen

Blue

12360

123

12312

KK10 SED

2010-05-01

Ford

Green

1290

124

Null

//
150000

Null

All Natural Key
Index Values
hash down
to bucket 123

IDX
Ptr
Bw-Tree (Latch-Free, Log-Structured)
Designed for Multi-Core, Main Memory and Flash based Storage
Avoids thread latch blocking – move towards MVCC and writer-writer fail
Record updates, splits done as “delta’s” – updates combined on write out
Exploits fast sequential writes (reducing random writes) – increases flash life
Mapping table maps Logical Page ID’s to Flash offset or memory pointer
Physical Location of Nodes allow to change without propagation to root
Tree Nodes are logical (why they aren’t stored)
Page size is elastic – split when convenient rather than on size (e.g. at 8KiB)
Latch-Free
Use Compare and Swap (CAS) instructions
Persistence of Thread exec helps preserve processor core cache
http://sites.computer.org/debull/A13june/bwtree1.pdf
http://research.microsoft.com/en-us/um/people/justinle/papers/ICDE2013_bwtree.pptx
http://research.microsoft.com/pubs/178758/bw-tree-icde2013-final.pdf
DEMO
CREATEDATA.sql
Key Concepts - Durability
What is Durability? ACID
Tables:
SCHEMA_ONLY
Setting: DELAYED_DURABILITY
Database {Disabled, Allowed, Forced}
Procedure option, Transaction option (on COMMIT)

Reduced Logging
No UNDO records * No need – everything fits in memory, no spill required
No Index records * No need – re-hash on loading data – take the hit on db start
DEMO
DURABILITY.sql
Key Concepts – MVCC #1
READ COMMITTED (Writer block reader)
MVCC (Multi-Version Concurrency Control)
MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT
WITH ( SNAPSHOT ), SET TRANSACTION ISOLATION LEVEL SNAPSHOT
Use WITH ( SNAPSHOT ) on FROM, COMMIT TRAN, UPDATE {table} etc.
Transaction preserves a “point in time” through versions
A

B
C

1

1

2

1

1

1

1

2

2

2

2

T
Key Concepts – MVCC #2 [in-memory]
READ_COMMITTED only for single statement transactions (not transaction nested)
If there is a transaction in-mem use SNAPSHOT
Watch out for MVCC – more versions = more memory used
Write-Write conflict – application behaviour change?
Applications dependent on locking - rethink
DEMO
MVCC.sql
Key Concepts – Native (Compiled)
Compiled Stored Proc stored in file system (..mssqldataxtp)
Loads of restrictions
Incredible performance boost
Plan created and fixed when CREATE PROC ran

Can you OPTIMISE FOR
Make sure you have data in your tables – of production size (statistics!)
DEMO
NATIVECOMPILED.sql
Ref: SQL Server 2014 Mission Critical Performance Level 300 Deck.pdf
Key Concepts – Querying
“Status Quo” in the most part
Mix in-memory tables with on-storage with some restrictions
If in a transaction you must use WITH( SNAPSHOT )
Migration path towards full blown performance of Hekaton
DEMO
QUERYING.sql
HA / DR
Works with Availability Groups
Works with Native SQL Server database and log backups
Does not replicate data from SCHEMA_ONLY tables
Implementation Ideas
AMR (Analysis Migration and Reporting) over your existing production box
Consider how to apply in-memory tables given how hash/bw-tree indexes work
Durability: SCHEMA_ONLY
ETL
Session State
Real-time Analytics calculations (from raw data stored in NoSQL)
Part of a LAMBDA archiecture
Durability: SCHEMA_AND_DATA with DELAYED_DURABILITY
High insert activity that you don’t mind losing some of in case of failure
Durable
Latch contention
References
SQL Server 2014 CTP2 Product Guide
http://www.microsoft.com/en-us/download/confirmation.aspx?id=39269
BW-Tree
http://research.microsoft.com/apps/pubs/default.aspx?id=178758
Microsoft Research Main Memory Databases Project page
http://research.microsoft.com/en-us/projects/main-memory_dbs

More Related Content

What's hot

HBaseCon 2013: Honeycomb - MySQL Backed by Apache HBase
HBaseCon 2013: Honeycomb - MySQL Backed by Apache HBase HBaseCon 2013: Honeycomb - MySQL Backed by Apache HBase
HBaseCon 2013: Honeycomb - MySQL Backed by Apache HBase Cloudera, Inc.
 
Real-time Data Loading from Oracle and MySQL to Data Warehouses, Analytics
Real-time Data Loading from Oracle and MySQL to Data Warehouses, AnalyticsReal-time Data Loading from Oracle and MySQL to Data Warehouses, Analytics
Real-time Data Loading from Oracle and MySQL to Data Warehouses, AnalyticsContinuent
 
Design Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformDesign Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformMarco Gralike
 
Cloudera Impala Internals
Cloudera Impala InternalsCloudera Impala Internals
Cloudera Impala InternalsDavid Groozman
 
Spark SQL Bucketing at Facebook
 Spark SQL Bucketing at Facebook Spark SQL Bucketing at Facebook
Spark SQL Bucketing at FacebookDatabricks
 
(Aaron myers) hdfs impala
(Aaron myers)   hdfs impala(Aaron myers)   hdfs impala
(Aaron myers) hdfs impalaNAVER D2
 
Cloudera Impala Source Code Explanation and Analysis
Cloudera Impala Source Code Explanation and AnalysisCloudera Impala Source Code Explanation and Analysis
Cloudera Impala Source Code Explanation and AnalysisYue Chen
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insightsKirill Loifman
 
Oracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesOracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesMarco Gralike
 
Redshift performance tuning
Redshift performance tuningRedshift performance tuning
Redshift performance tuningCarlos del Cacho
 
Oracle database 12c intro
Oracle database 12c introOracle database 12c intro
Oracle database 12c intropasalapudi
 
Habits of Effective Sqoop Users
Habits of Effective Sqoop UsersHabits of Effective Sqoop Users
Habits of Effective Sqoop UsersKathleen Ting
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performanceguest9912e5
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...Alex Zaballa
 
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...Continuent
 
Hive and HiveQL - Module6
Hive and HiveQL - Module6Hive and HiveQL - Module6
Hive and HiveQL - Module6Rohit Agrawal
 
Sap basis administrator user guide
Sap basis administrator   user guideSap basis administrator   user guide
Sap basis administrator user guidePoguttuezhiniVP
 

What's hot (20)

HBaseCon 2013: Honeycomb - MySQL Backed by Apache HBase
HBaseCon 2013: Honeycomb - MySQL Backed by Apache HBase HBaseCon 2013: Honeycomb - MySQL Backed by Apache HBase
HBaseCon 2013: Honeycomb - MySQL Backed by Apache HBase
 
Real-time Data Loading from Oracle and MySQL to Data Warehouses, Analytics
Real-time Data Loading from Oracle and MySQL to Data Warehouses, AnalyticsReal-time Data Loading from Oracle and MySQL to Data Warehouses, Analytics
Real-time Data Loading from Oracle and MySQL to Data Warehouses, Analytics
 
Design Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will PerformDesign Concepts For Xml Applications That Will Perform
Design Concepts For Xml Applications That Will Perform
 
Cloudera Impala Internals
Cloudera Impala InternalsCloudera Impala Internals
Cloudera Impala Internals
 
User Group3009
User Group3009User Group3009
User Group3009
 
Spark SQL Bucketing at Facebook
 Spark SQL Bucketing at Facebook Spark SQL Bucketing at Facebook
Spark SQL Bucketing at Facebook
 
ORC 2015: Faster, Better, Smaller
ORC 2015: Faster, Better, SmallerORC 2015: Faster, Better, Smaller
ORC 2015: Faster, Better, Smaller
 
(Aaron myers) hdfs impala
(Aaron myers)   hdfs impala(Aaron myers)   hdfs impala
(Aaron myers) hdfs impala
 
Cloudera Impala Source Code Explanation and Analysis
Cloudera Impala Source Code Explanation and AnalysisCloudera Impala Source Code Explanation and Analysis
Cloudera Impala Source Code Explanation and Analysis
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insights
 
Oracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New FeaturesOracle Database 11g Release 2 - XMLDB New Features
Oracle Database 11g Release 2 - XMLDB New Features
 
Apache hive
Apache hiveApache hive
Apache hive
 
Redshift performance tuning
Redshift performance tuningRedshift performance tuning
Redshift performance tuning
 
Oracle database 12c intro
Oracle database 12c introOracle database 12c intro
Oracle database 12c intro
 
Habits of Effective Sqoop Users
Habits of Effective Sqoop UsersHabits of Effective Sqoop Users
Habits of Effective Sqoop Users
 
15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance15 Ways to Kill Your Mysql Application Performance
15 Ways to Kill Your Mysql Application Performance
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata  Expr...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expr...
 
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
New VMware Continuent 5.0 - A powerful and cost-efficient Oracle GoldenGate a...
 
Hive and HiveQL - Module6
Hive and HiveQL - Module6Hive and HiveQL - Module6
Hive and HiveQL - Module6
 
Sap basis administrator user guide
Sap basis administrator   user guideSap basis administrator   user guide
Sap basis administrator user guide
 

Viewers also liked

Why SQL Server 2014 Cardinality Estimator is *the* killer feature
Why SQL Server 2014 Cardinality Estimator is *the* killer featureWhy SQL Server 2014 Cardinality Estimator is *the* killer feature
Why SQL Server 2014 Cardinality Estimator is *the* killer featureSolarWinds
 
Veja em primeira mão os tópicos de tecnologia de 2016
Veja em primeira mão os tópicos de tecnologia de 2016Veja em primeira mão os tópicos de tecnologia de 2016
Veja em primeira mão os tópicos de tecnologia de 2016SolarWinds
 
Why new hardware may not make SQL Server faster
Why new hardware may not make SQL Server fasterWhy new hardware may not make SQL Server faster
Why new hardware may not make SQL Server fasterSolarWinds
 
The have no fear guide to virtualizing databases
The have no fear guide to virtualizing databasesThe have no fear guide to virtualizing databases
The have no fear guide to virtualizing databasesSolarWinds
 
Leveraging memory in sql server
Leveraging memory in sql serverLeveraging memory in sql server
Leveraging memory in sql serverChris Adkin
 
Building scalable application with sql server
Building scalable application with sql serverBuilding scalable application with sql server
Building scalable application with sql serverChris Adkin
 
Azure Machine Learning
Azure Machine LearningAzure Machine Learning
Azure Machine LearningDavide Mauri
 

Viewers also liked (7)

Why SQL Server 2014 Cardinality Estimator is *the* killer feature
Why SQL Server 2014 Cardinality Estimator is *the* killer featureWhy SQL Server 2014 Cardinality Estimator is *the* killer feature
Why SQL Server 2014 Cardinality Estimator is *the* killer feature
 
Veja em primeira mão os tópicos de tecnologia de 2016
Veja em primeira mão os tópicos de tecnologia de 2016Veja em primeira mão os tópicos de tecnologia de 2016
Veja em primeira mão os tópicos de tecnologia de 2016
 
Why new hardware may not make SQL Server faster
Why new hardware may not make SQL Server fasterWhy new hardware may not make SQL Server faster
Why new hardware may not make SQL Server faster
 
The have no fear guide to virtualizing databases
The have no fear guide to virtualizing databasesThe have no fear guide to virtualizing databases
The have no fear guide to virtualizing databases
 
Leveraging memory in sql server
Leveraging memory in sql serverLeveraging memory in sql server
Leveraging memory in sql server
 
Building scalable application with sql server
Building scalable application with sql serverBuilding scalable application with sql server
Building scalable application with sql server
 
Azure Machine Learning
Azure Machine LearningAzure Machine Learning
Azure Machine Learning
 

Similar to SQL Server 2014 In-Memory Tables (XTP, Hekaton)

Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Building a high-performance data lake analytics engine at Alibaba Cloud with ...Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Building a high-performance data lake analytics engine at Alibaba Cloud with ...Alluxio, Inc.
 
SQL Server Integration Services Tips & Tricks
SQL Server Integration Services Tips & TricksSQL Server Integration Services Tips & Tricks
SQL Server Integration Services Tips & TricksGuillermo Caicedo
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon RedshiftBest Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon RedshiftAmazon Web Services
 
Sql server 2016 it just runs faster sql bits 2017 edition
Sql server 2016 it just runs faster   sql bits 2017 editionSql server 2016 it just runs faster   sql bits 2017 edition
Sql server 2016 it just runs faster sql bits 2017 editionBob Ward
 
SQL Server It Just Runs Faster
SQL Server It Just Runs FasterSQL Server It Just Runs Faster
SQL Server It Just Runs FasterBob Ward
 
Making MySQL Great For Business Intelligence
Making MySQL Great For Business IntelligenceMaking MySQL Great For Business Intelligence
Making MySQL Great For Business IntelligenceCalpont
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon RedshiftBest Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon RedshiftAmazon Web Services
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...javier ramirez
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift Amazon Web Services
 
Experience sql server on l inux and docker
Experience sql server on l inux and dockerExperience sql server on l inux and docker
Experience sql server on l inux and dockerBob Ward
 
Modernizing Mission-Critical Apps with SQL Server
Modernizing Mission-Critical Apps with SQL ServerModernizing Mission-Critical Apps with SQL Server
Modernizing Mission-Critical Apps with SQL ServerMicrosoft Tech Community
 
In-memory ColumnStore Index
In-memory ColumnStore IndexIn-memory ColumnStore Index
In-memory ColumnStore IndexSolidQ
 
Best Practices for Migrating Your Data Warehouse to Amazon Redshift
Best Practices for Migrating Your Data Warehouse to Amazon RedshiftBest Practices for Migrating Your Data Warehouse to Amazon Redshift
Best Practices for Migrating Your Data Warehouse to Amazon RedshiftAmazon Web Services
 
SQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedSQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedTony Rogerson
 
SQL Server 2008 Development for Programmers
SQL Server 2008 Development for ProgrammersSQL Server 2008 Development for Programmers
SQL Server 2008 Development for ProgrammersAdam Hutson
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part isqlserver.co.il
 
Obevo Javasig.pptx
Obevo Javasig.pptxObevo Javasig.pptx
Obevo Javasig.pptxLadduAnanu
 
AWS Cloud SAA Relational Database presentation
AWS Cloud SAA Relational Database presentationAWS Cloud SAA Relational Database presentation
AWS Cloud SAA Relational Database presentationTATA LILIAN SHULIKA
 
About "Apache Cassandra"
About "Apache Cassandra"About "Apache Cassandra"
About "Apache Cassandra"Jihyun Ahn
 

Similar to SQL Server 2014 In-Memory Tables (XTP, Hekaton) (20)

Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Building a high-performance data lake analytics engine at Alibaba Cloud with ...Building a high-performance data lake analytics engine at Alibaba Cloud with ...
Building a high-performance data lake analytics engine at Alibaba Cloud with ...
 
SQL Server Integration Services Tips & Tricks
SQL Server Integration Services Tips & TricksSQL Server Integration Services Tips & Tricks
SQL Server Integration Services Tips & Tricks
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon RedshiftBest Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift
 
Sql server 2016 it just runs faster sql bits 2017 edition
Sql server 2016 it just runs faster   sql bits 2017 editionSql server 2016 it just runs faster   sql bits 2017 edition
Sql server 2016 it just runs faster sql bits 2017 edition
 
SQL Server It Just Runs Faster
SQL Server It Just Runs FasterSQL Server It Just Runs Faster
SQL Server It Just Runs Faster
 
Making MySQL Great For Business Intelligence
Making MySQL Great For Business IntelligenceMaking MySQL Great For Business Intelligence
Making MySQL Great For Business Intelligence
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon RedshiftBest Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
 
Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift Best Practices for Migrating your Data Warehouse to Amazon Redshift
Best Practices for Migrating your Data Warehouse to Amazon Redshift
 
Experience sql server on l inux and docker
Experience sql server on l inux and dockerExperience sql server on l inux and docker
Experience sql server on l inux and docker
 
Modernizing Mission-Critical Apps with SQL Server
Modernizing Mission-Critical Apps with SQL ServerModernizing Mission-Critical Apps with SQL Server
Modernizing Mission-Critical Apps with SQL Server
 
In-memory ColumnStore Index
In-memory ColumnStore IndexIn-memory ColumnStore Index
In-memory ColumnStore Index
 
Best Practices for Migrating Your Data Warehouse to Amazon Redshift
Best Practices for Migrating Your Data Warehouse to Amazon RedshiftBest Practices for Migrating Your Data Warehouse to Amazon Redshift
Best Practices for Migrating Your Data Warehouse to Amazon Redshift
 
SQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - AdvancedSQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - Advanced
 
Nosql seminar
Nosql seminarNosql seminar
Nosql seminar
 
SQL Server 2008 Development for Programmers
SQL Server 2008 Development for ProgrammersSQL Server 2008 Development for Programmers
SQL Server 2008 Development for Programmers
 
1 extreme performance - part i
1   extreme performance - part i1   extreme performance - part i
1 extreme performance - part i
 
Obevo Javasig.pptx
Obevo Javasig.pptxObevo Javasig.pptx
Obevo Javasig.pptx
 
AWS Cloud SAA Relational Database presentation
AWS Cloud SAA Relational Database presentationAWS Cloud SAA Relational Database presentation
AWS Cloud SAA Relational Database presentation
 
About "Apache Cassandra"
About "Apache Cassandra"About "Apache Cassandra"
About "Apache Cassandra"
 

Recently uploaded

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

SQL Server 2014 In-Memory Tables (XTP, Hekaton)

  • 1. SQL Server 2014 In-Memory Tables (Extreme Transaction Processing) Tony Rogerson, SQL Server MVP @tonyrogerson tonyrogerson@torver.net http://dataidol.com/tonyrogerson
  • 2. Who am I? Freelance SQL Server professional and Data Specialist Started out in 1986 – DB2, Oracle, SQL Server since 4.21a SQL Server MVP since 97 Fellow BCS, MSc in BI, studying for Data Science PGCert Allotment holder – onions and garlic were rubbish this year Interested in Data Science especially commodity based distributed processing (NoSanMan!)
  • 3. Agenda What’s an in-Memory database? SQL Server in-Memory technologies – OLAP and OLTP Getting Started with Hekaton Implementation ideas and moving forward
  • 4. In-Memory Database/Table? In-Memory Landscape (Nov 2013 – a small section!) Oracle – TimesTen (embedded into DB Cache, Exalytics) SAP – HANA IBM solidDB SQL Server xVelocity (next generation of Vertipaq) – Column Store SQL Server Hekaton (for OLTP – relational type workloads) Database Cache OR proper in-Memory database Entire DB in memory / Selected tables (mix with stable storage)
  • 5. SQL Server in-Memory OLAP / OLTP Column Store (xVelocity - used to be called Vertipaq) Column Store Indexing (read only) New “CLUSTERED” column store index allowing ins/del/upd Really in-memory or just compression? In-Memory Tables (Hekaton) – Extreme Transaction Processing (XTP) Geared to new storage paradigm of Flash and multi-core machines Memory and Flash optimised with new Bw-Tree (Buzz Word Tree) and Hash indexing Natively Compiled Stored Procedures Join in-memory data with legacy B-Tree/Heap on stable storage Allows us to remove the need for Durability (hoorah!) StreamInsight – Complex Events Processing
  • 6. Getting Started with Hekaton Database composition Hash Indexes – B+Tree or BW-Tree Durability [or not] – Transaction Logging Isolation Interop or Native in-Memory Native Compilation
  • 7. Database Composition 1 File Group, 1 or More files
  • 8. Storage (Database Start Up) Memory RAW DATA on Storage (no index data) Raw Data Build Bw-Tree Queryable Uses File-Stream Data loaded, indexes built on Database recovery Make sure the IO Sub-system can handle the load – it will swamp the IO’s Offline CHECKPOINT saves tables SCHEMA_AND_DATA durability to File-Stream (storage)
  • 9. File Stream Normal tables: Bulked up IO through lazywriter {over}-Writes are to set database structure Random IO causes latency issues Blocked IO causes Flash wear XTP: Writes append to multiple 128MiB files No need to write Index changes or internal structures Just need the delta’s for recovery Use multiple files on the in-memory file group for performance
  • 10. Balance – Buffer Pool v XTP XTP competes with the Buffer Pool Use Resource Pool to limit XTP Base resource pool memory on the minimum requirement Versioning needs to be considered – multiple versions of the row!
  • 11. DEMO #1 - DB CREATEDB.sql
  • 12. New Index types HASH index – for expressions of equality Hash of the index (key) columns – no DRI If it can’t seek it will scan – scan everything! Range index – for everything else Bw(Buzz Word)-Tree Derivative of the B+Tree but Elastic page sizes No update – updates through versioning and processing the delta’s on commit
  • 13. Hash indexing Array [Mapping Table] of cells [Hash Buckets] Eg. {CHECKSUM( “Jen Stirrup” ), CHECKSUM( “Anthony Saxby” )} Hash collision forms a chain of rows (1 bucket has a row chain – rows sharing same hash) Reduce hash collisions by increasing the BUCKET_COUNT Ideal is BUCKET_COUNT = number of unique values x2 (depends on hash collisions too) Buckets use memory Careful on composite keys – the complete key is hashed making part lookups unable to use the index. Character data-type required to be Latin1_General_100_BIN2 @ Database level @ Column Level e.g. avarchar varchar(50) COLLATE Latin1_General_100_BIN2 not null
  • 14. Hash Bucket # Hash Index Pointer (64bit) 0 Null 123 // // 122 Hash Function 1 Null 12312 124 LP13 VSF HASH 123 NaturalKey Null Null Range 0 – 150,000 // 150000 NaturalKey DateRegistered Make Colour Memory Location AA13 SAE 2013-01-01 Ford Red 0 LP13 VSF 2013-05-01 Volkswagen Blue 12312 Null
  • 15. Hash Bucket # Hash Index - Usage Pointer (64bit) 1 Null // Null 123 12312 124 Range 0 – 150,000 Null // 123 0 122 WHERE NaturalKey = ‘LP13 VSF’ HASH Hash Function Null // 150000 NaturalKey DateRegistered Make Colour Memory Location AA13 SAE 2013-01-01 Ford Red 0 LP13 VSF 2013-05-01 Volkswagen Blue 12312 Null
  • 16. Hash Index – Range expressions Hash [seek] is an equality / inequality only operation WHERE NaturalKey > ‘LP13 VSF’ makes no sense WHERE Hash(NaturalKey) > Hash( ‘LP13 VSF’ ) WHERE 123 > 123 WHERE HASH( NaturalKey [a..e] ) > HASH( ‘a’ )
  • 17. Hash Index (reality) Hash Bucket # Pointer (64bit) 0 Null 1 Null // // 122 NaturalKey DateRegistered Make Colour Memory Begin/End Location Timestamp LP13 VSF 2013-05-01 Volkswagen Blue 12312 KK10 SED 2010-05-01 Ford Green 12355 Null LP13 VSF 2013-05-01 Volkswagen Blue 12360 123 12312 KK10 SED 2010-05-01 Ford Green 1290 124 Null // 150000 Null All Natural Key Index Values hash down to bucket 123 IDX Ptr
  • 18. Bw-Tree (Latch-Free, Log-Structured) Designed for Multi-Core, Main Memory and Flash based Storage Avoids thread latch blocking – move towards MVCC and writer-writer fail Record updates, splits done as “delta’s” – updates combined on write out Exploits fast sequential writes (reducing random writes) – increases flash life Mapping table maps Logical Page ID’s to Flash offset or memory pointer Physical Location of Nodes allow to change without propagation to root Tree Nodes are logical (why they aren’t stored) Page size is elastic – split when convenient rather than on size (e.g. at 8KiB) Latch-Free Use Compare and Swap (CAS) instructions Persistence of Thread exec helps preserve processor core cache http://sites.computer.org/debull/A13june/bwtree1.pdf http://research.microsoft.com/en-us/um/people/justinle/papers/ICDE2013_bwtree.pptx http://research.microsoft.com/pubs/178758/bw-tree-icde2013-final.pdf
  • 20. Key Concepts - Durability What is Durability? ACID Tables: SCHEMA_ONLY Setting: DELAYED_DURABILITY Database {Disabled, Allowed, Forced} Procedure option, Transaction option (on COMMIT) Reduced Logging No UNDO records * No need – everything fits in memory, no spill required No Index records * No need – re-hash on loading data – take the hit on db start
  • 22. Key Concepts – MVCC #1 READ COMMITTED (Writer block reader) MVCC (Multi-Version Concurrency Control) MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT WITH ( SNAPSHOT ), SET TRANSACTION ISOLATION LEVEL SNAPSHOT Use WITH ( SNAPSHOT ) on FROM, COMMIT TRAN, UPDATE {table} etc. Transaction preserves a “point in time” through versions A B C 1 1 2 1 1 1 1 2 2 2 2 T
  • 23. Key Concepts – MVCC #2 [in-memory] READ_COMMITTED only for single statement transactions (not transaction nested) If there is a transaction in-mem use SNAPSHOT Watch out for MVCC – more versions = more memory used Write-Write conflict – application behaviour change? Applications dependent on locking - rethink
  • 25. Key Concepts – Native (Compiled) Compiled Stored Proc stored in file system (..mssqldataxtp) Loads of restrictions Incredible performance boost Plan created and fixed when CREATE PROC ran Can you OPTIMISE FOR Make sure you have data in your tables – of production size (statistics!)
  • 27. Ref: SQL Server 2014 Mission Critical Performance Level 300 Deck.pdf
  • 28. Key Concepts – Querying “Status Quo” in the most part Mix in-memory tables with on-storage with some restrictions If in a transaction you must use WITH( SNAPSHOT ) Migration path towards full blown performance of Hekaton
  • 30. HA / DR Works with Availability Groups Works with Native SQL Server database and log backups Does not replicate data from SCHEMA_ONLY tables
  • 31. Implementation Ideas AMR (Analysis Migration and Reporting) over your existing production box Consider how to apply in-memory tables given how hash/bw-tree indexes work Durability: SCHEMA_ONLY ETL Session State Real-time Analytics calculations (from raw data stored in NoSQL) Part of a LAMBDA archiecture Durability: SCHEMA_AND_DATA with DELAYED_DURABILITY High insert activity that you don’t mind losing some of in case of failure Durable Latch contention
  • 32. References SQL Server 2014 CTP2 Product Guide http://www.microsoft.com/en-us/download/confirmation.aspx?id=39269 BW-Tree http://research.microsoft.com/apps/pubs/default.aspx?id=178758 Microsoft Research Main Memory Databases Project page http://research.microsoft.com/en-us/projects/main-memory_dbs