SQL Server 2014 In-Memory Tables (Extreme Transaction Processing)

Similar documents
W I S E. SQL Server 2008/2008 R2 Advanced DBA Performance & WISE LTD.

Hekaton: SQL Server s Memory-Optimized OLTP Engine

Course 55144B: SQL Server 2014 Performance Tuning and Optimization

"Charting the Course... MOC AC SQL Server 2014 Performance Tuning and Optimization. Course Summary

Course 55144: SQL Server 2014 Performance Tuning and Optimization

SQL Server 2016 New Features!

BOOST YOUR SQL PERFORMANCE BY USING THE NEW

Course Outline. SQL Server 2014 Performance Tuning and Optimization Course 55144: 5 days Instructor Led

SQL Server 2014 Performance Tuning and Optimization 55144; 5 Days; Instructor-led

20464C: Developing Microsoft SQL Server Databases

Developing Microsoft SQL Server Databases 20464C; 5 Days

Boost SQL Server Performance Buffer Pool Extensions & Delayed Durability

Developing Microsoft SQL Server Databases (20464) H8N64S

SQL Server 2014 New Features/In- Memory Store. Juergen Thomas Microsoft Corporation

Course 20464: Developing Microsoft SQL Server Databases

In-Memory Databases MemSQL

SQL Server Transaction Log from A to Z

Developing Microsoft SQL Server Databases

SQL Server In-Memory OLTP Internals Overview for CTP2

Storage and File Structure

Performance Verbesserung von SAP BW mit SQL Server Columnstore

SQL Server Encryption Overview. September 2, 2015

SQL 2014 CTP1. Hekaton & CSI Version 2 unter der Lupe. Sascha Götz Karlsruhe, 03. Dezember 2013

MS-40074: Microsoft SQL Server 2014 for Oracle DBAs

David Dye. Extract, Transform, Load

Developing Microsoft SQL Server Databases MOC 20464

SQL Server What s New? Christopher Speer. Technology Solution Specialist (SQL Server, BizTalk Server, Power BI, Azure) v-cspeer@microsoft.

MS SQL Server 2014 New Features and Database Administration

Practical Cassandra. Vitalii

Exploring In-Memory OLTP

In-Memory Data Management for Enterprise Applications

Oracle Database 10g. Page # The Self-Managing Database. Agenda. Benoit Dageville Oracle Corporation benoit.dageville@oracle.com

Microsoft SQL Database Administrator Certification

Would-be system and database administrators. PREREQUISITES: At least 6 months experience with a Windows operating system.

Course 20464C: Developing Microsoft SQL Server Databases

Mind Q Systems Private Limited

Outline. MCSE: Data Platform. Course Content. Course 10776C: MCSA: Developing Microsoft SQL Server 2012 Databases 5 Days

SQL Server In-Memory by Design. Anu Ganesan August 8, 2014

DB2 for Linux, UNIX, and Windows Performance Tuning and Monitoring Workshop

SQL Server 2012 Database Administration With AlwaysOn & Clustering Techniques

Columnstore in SQL Server 2016

Exam Number/Code : Exam Name: Name: PRO:MS SQL Serv. 08,Design,Optimize, and Maintain DB Admin Solu. Version : Demo.

SQL Server 2012 Optimization, Performance Tuning and Troubleshooting

HOUG Konferencia Oracle TimesTen In-Memory Database and TimesTen Application-Tier Database Cache. A few facts in 10 minutes

Hypertable Architecture Overview

Oracle Architecture, Concepts & Facilities

MIRRORING: START TO FINISH. Ryan Adams Blog - Twitter

$99.95 per user. SQL Server 2008/R2 Database Administration CourseId: 157 Skill level: Run Time: 47+ hours (272 videos)

Oracle EXAM - 1Z Oracle Database 11g Release 2: SQL Tuning. Buy Full Product.

How To Improve Performance In A Database

Rdb Directions & Strategies

IBM DB2: LUW Performance Tuning and Monitoring for Single and Multiple Partition DBs

WITH A FUSION POWERED SQL SERVER 2014 IN-MEMORY OLTP DATABASE

Many DBA s are being required to support multiple DBMS s on multiple platforms. Many IT shops today are running a combination of Oracle and DB2 which

Microsoft Data Platform Evolution

Upon completion of the program, students are given a full support to take and pass Microsoft certification examinations.

IN-MEMORY DATABASE SYSTEMS. Prof. Dr. Uta Störl Big Data Technologies: In-Memory DBMS - SoSe

<Insert Picture Here> Oracle Database Directions Fred Louis Principal Sales Consultant Ohio Valley Region

F1: A Distributed SQL Database That Scales. Presentation by: Alex Degtiar (adegtiar@cmu.edu) /21/2013

COS 318: Operating Systems

1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle

Expert Oracle. Database Architecture. Techniques and Solutions. 10gr, and 11g Programming. Oracle Database 9/, Second Edition.

SQL 2016 and SQL Azure

This article Includes:

SQL Server In-Memory OLTP and Columnstore Feature Comparison

MOC 20461C: Querying Microsoft SQL Server. Course Overview

CASE STUDY: Oracle TimesTen In-Memory Database and Shared Disk HA Implementation at Instance level. -ORACLE TIMESTEN 11gR1

Safe Harbor Statement

Microsoft SQL Server Security and Auditing Clay Risenhoover ISACA North Texas April 14,

Microsoft SQL Server performance tuning for Microsoft Dynamics NAV

Microsoft SQL Server for Oracle DBAs Course 40045; 4 Days, Instructor-led

Improve Business Productivity and User Experience with a SanDisk Powered SQL Server 2014 In-Memory OLTP Database

Ontrack PowerControls V8.1 for SQL ReadMe

In-memory databases and innovations in Business Intelligence

SAP Business Objects Business Intelligence platform Document Version: 4.1 Support Package Data Federation Administration Tool Guide

Performance Tuning and Optimizing SQL Databases 2016

Enhancing SQL Server Performance

Introduction. Part I: Finding Bottlenecks when Something s Wrong. Chapter 1: Performance Tuning 3

SharePoint 2010 Performance and Capacity Planning Best Practices

Who am I? Copyright 2014, Oracle and/or its affiliates. All rights reserved. 3

Oracle DBA Course Contents

MOC 20462C: Administering Microsoft SQL Server Databases

SAP HANA - Main Memory Technology: A Challenge for Development of Business Applications. Jürgen Primsch, SAP AG July 2011

Oracle Database 11 g Performance Tuning. Recipes. Sam R. Alapati Darl Kuhn Bill Padfield. Apress*

Physical Data Organization

SQL Server 2008 Designing, Optimizing, and Maintaining a Database Session 1

Raima Database Manager Version 14.0 In-memory Database Engine

Inge Os Sales Consulting Manager Oracle Norway

Updating Your SQL Server Skills to Microsoft SQL Server 2014

Course Outline. Upgrading Your Skills to SQL Server 2016 Course 10986A: 5 days Instructor Led

<Insert Picture Here> Oracle In-Memory Database Cache Overview

low-level storage structures e.g. partitions underpinning the warehouse logical table structures

Module 14: Scalability and High Availability

Optimize Oracle Business Intelligence Analytics with Oracle 12c In-Memory Database Option

Microsoft SQL Server OLTP Best Practice

6231A - Maintaining a Microsoft SQL Server 2008 Database

Tips and Tricks for Using Oracle TimesTen In-Memory Database in the Application Tier

Transcription:

SQL Server 2014 In-Memory Tables (Extreme Transaction Processing) Basics Tony Rogerson, SQL Server MVP @tonyrogerson tonyrogerson@torver.net http://www.sql-server.co.uk

Who am I? Freelance SQL Server professional and Data Specialist Fellow BCS, MSc in BI, PGCert in Data Science Started out in 1986 VSAM, System W, Application System, DB2, Oracle, SQL Server since 4.21a Awarded SQL Server MVP yearly since 97 Founded UK SQL Server User Group back in 99, founder member of DDD, SQL Bits, SQL Relay, SQL Santa and Project Mildred Interested in commodity based distributed processing of Data. I have an allotment where I grow vegetables - I do not do any analysis on how they grow, where they grow etc. My allotment is where I escape technology.

Agenda Define concept In-Memory Implementation Storage Memory, Buffer Pool and using Resource Pools Memory Optimised Tables and Index Types Native Stored Procedures Queries HA / DR Planning

Define In-Memory

What is IMDB / DBIM / IMT? Entire database resides in Main memory Hybrid - selective tables reside entirely in memory Row / Column store Oracle keeps two copies of the data in row AND column store optimiser chooses, no app change required SQL Server 2014 you choose Columnstore (Column Store Indexing) traditionally for OLAP Rowstore (memory optimised table with hash or range index) traditionally for OLTP Non-Volatile Memory changes everything it s here now! SQL Server 2014 Buffer Pool Extensions

SQL Server in-memory Column Store (designed for OLAP) Column compression to reduce memory required SQL 2012: One index per table, nonclustered only, table read-only SQL 2014: Only index on table clustered, table is now updateable Memory Optimised Tables (designed for OLTP) Standard CREATE TABLE with restrictions on FK s and other constraints

Implementation

FILESTREAM underpins XTP

Storage - FILESTREAM

Storage - FILESTREAM

DEMO CREATE DATABASE.sql

Database Recovery RAW DATA on Storage (no index data) Memory Raw Data Build Range and Hash Indexes Queryable Make sure the IO Sub-system can handle the load it will swamp the IO Sub-System Only the Raw Data is stored no need to hold indexes (everything fits in memory!)

SQL Server Memory Pools Buffer Pool SQL Server Memory Space Table Data Data in/out as required Stable Storage (MDF/NDF Files) Memory Internal Structures (proc/log cache etc.)

SQL Server Memory Pools Buffer Pool SQL Server Memory Space Table Data Data in/out as required Stable Storage (MDF/NDF Files) Memory Internal Structures (proc/log cache etc.) Memory Optimised Tables

Best Practice Create Resource Pool CREATE RESOURCE POOL mem_xtp_pool WITH ( MAX_MEMORY_PERCENT = 50, MIN_MEMORY_PERCENT = 50 ); ALTER RESOURCE GOVERNOR RECONFIGURE; EXEC sp_xtp_bind_db_resource_pool 'xtp_demo', 'mem_xtp_pool'; ALTER DATABASE xtp_demo SET OFFLINE WITH ROLLBACK IMMEDIATE; ALTER DATABASE xtp_demo SET ONLINE;

DEMO RESOURCE POOL.sql

Memory Optimised Table

Table Structure New option on WITH ( MEMORY_OPTIMIZED = ON DURABILITY = SCHEMA_AND_DATA SCHEMA_ONLY ) Maximum 8 indexes per table Choice of two index types: Hash (only good for equality expressions) Range (good for everything)

Table Structure Compiled to.c structure Cannot ALTER TABLE only DROP/CREATE Data is stored in FILESTREAM files (not MDF) Logging still done to LDF (SCHEMA_AND_DATA only) Statistics are not automatically updated require: UPDATE STATISTICS {table} WITH FULLSCAN, NORECOMPUTE, ALL

Table Declaration IDENTITY( 1, 1 ) only use SEQUENCE if not suitable DEFAULT constraints ok No Foreign Key constraints No Check constraints No UNIQUE constraints only PRIMARY KEY allowed CREATE VIEW works (but view not usable from Native Stored Procedure)

Useful DMV s sys.hash_indexes sys.dm_db_xtp_hash_index_stats sys.dm_db_xtp_table_memory_stats sys.dm_db_xtp_index_stats sys.dm_db_xtp_object_stats

DEMO CREATE TABLE.sql DML.sql

Hash Index and Row Chains

BUCKET_COUNT options 1024 8 kilobytes 2048 16 kilobytes 4096 32 kilobytes 8192 64 kilobytes 16384 128 kilobytes 32768 256 kilobytes 65536 512 kilobytes 131072 1 megabytes 262144 2 megabytes 524288 4 megabytes 1048576 8 megabytes 2097152 16 megabytes 4194304 32 megabytes 8388608 64 megabytes 16777216 128 megabytes 33554432 256 megabytes 67108864 512 megabytes 134217728 1,024 megabytes 268435456 2,048 megabytes 536870912 4,096 megabytes 1073741824 8,192 megabytes

Range Index (B w Tree B + Tree) B + Tree B w Tree Root 1 row tracks a page in level below Root Leaf 8KiB Leaf 8KiB Leaf row per table row {index-col}{pointer} Leaf row per unique value {index-col}{memory-pointer} Row Chain

DEMO INDEXING.sql

Best Practice Index recommendations Use HASH when Mostly unique values Query uses expressions Equality i.e. = or!= Set BUCKET_COUNT appropriately Seriously think if you are considering composite index Use RANGE when Expressions are not Equality e.g. < > between Composite Index Low Cardinality

Multi-Version Concurrency Control (MVCC) Compare And Swap replaces Latching Update is actually INSERT and Tombstone Row Versions [kept in memory] Garbage collection task cleans up versions no longer required (stale data rows) Versions no longer required determined by active transactions may be inter-connection dependencies Your in-memory table can double, triple, x 100 etc. in size depending on access patterns (data mods + query durations) Row chains can expand dramatically and cause really poor performance

Versions in the Row Chain TS_START TS_END Connection 2 NULL 55 Newest 7 NULL 60 50 NULL 80 Oldest

Versions in the Row Chain TS_START TS_END Connection 2 10 55 Newest 7 NULL 60 50 NULL 80 Oldest Tombstone

Versions in the Row Chain TS_START TS_END Connection 2 NULL 55 Current Tombstone 7 NULL 60 50 NULL 80

Natively Compiled Procedures Compiled via C code Table statistics [which are not auto-updated] used when proc is created {very}restricted functionality (they are working on it) Massive speed improvements possible

DEMO NATIVE PROCS.sql

Querying Understanding Isolation and mixing memory optimised and storage optimised tables

SNAPSHOT Isolation Your connection has a Snapshot of the Data that you just read Snapshot is persistent and isolated from other connections using Versioning (MVCC). Default SQL Server isolation is READ COMMITTED Inside a transaction you must specify WITH ( SNAPSHOT ) to override the default isolation level Cannot use SET TRANSACTION ISOLATION SNAPSHOT with transactions and in-memory tables MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT database setting

DEMO QUERYING.sql

Querying (interop) Not supported: Linked Tables Cross database joins (except table vars and temp tables) Reference from indexed view MERGE (memory optimised table as target) TRUNCATE TABLE CLR using context connection A load of table hints, see: http://msdn.microsoft.com/enus/library/dn133177.aspx Must use WITH ( SNAPSHOT ) when statement is not auto-commit.

HADR - DEMO HADR.sql

Backup / Restore Meta-data only for Non-Durable tables (no data!) Backup is self-contained Full backup Differentials Logs Restore in Standby Remember Data is loaded into memory on recovery [standby performs a semi-recovery] Make sure you have enough memory on the secondary

Availability Groups Yep they work too Differs from Log restore Data and Indexes already in memory Readable secondary replica s work SCHEMA_ONLY (Non-Durable) tables will be empty!

Planning Thinking through the possibilities

Migration - DEMO Table: Memory Optimiser Advisor Stored Procedure: Native Compilation Advisor

Migrating Tables Throw it all in memory? Probably not a good idea! Partition through View mix memory and storage optimised Only index what you need + monitor and remove ones not required Application Transaction duration/number of updates suitable?