Migrating a Disk-based Table to a Memory-optimized one in SQL Server

Slides:



Advertisements
Similar presentations
Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
Advertisements

new database engine component fully integrated into SQL Server 2014 optimized for OLTP workloads accessing memory resident data achive improvements.
Big Data Working with Terabytes in SQL Server Andrew Novick
Project Management Database and SQL Server Katmai New Features Qingsong Yao
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
Overview SQL Server 2008 Overview Presented by Tarek Ghazali IT Technical Specialist Microsoft SQL Server MVP, MCTS Microsoft Web Development MCP ITIL.
Module 4: Data Objects. Overview Tables are the main objects that store data Indexes, views, stored programs and other objects are the support structures.
Hive : A Petabyte Scale Data Warehouse Using Hadoop
Chapter 7 SQL HUANG XUEHUA. SQL SQL server2005 introduction Install components  management studio.
Architecture Rajesh. Components of Database Engine.
Chokchai Junchey Microsoft Product Specialist Certified Technical Training Center.
SQL Data Definition Language (DDL) Using Microsoft SQL Server 1SDL Data Definition Language (DDL)
SQL SQL Server : Overview SQL : Overview Types of SQL Database : Creation Tables : Creation & Manipulation Data : Creation & Manipulation Data : Retrieving.
11 3 / 12 CHAPTER Databases MIS105 Lec15 Irfan Ahmed Ilyas.
Application Data and Database Activities Auditing Dr. Gabriel.
Data Types Lesson 4. Skills Matrix Table A table stores your data. Tables are relational in that they are organized as rows and columns (a matrix). Each.
SQL Server 2005 Implementation and Maintenance Chapter 3: Tables and Views.
INTRODUCING SQL SERVER 2012 COLUMNSTORE INDEXES Exploring and Managing SQL Server 2012 Database Engine Improvements.
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
The Baker’s Dozen Business Intelligence 13 Productivity Tips for In-Memory OLTP Enhancements in SQL 2016 Kevin S. Goff Microsoft SQL.
In-Memory OLTP The faster is now simpler in SQL Server 2016.
UNIQUE AND NOT DULLwww.MyGareth.com. UNIQUE AND NOT DULLwww.MyGareth.com Agenda New Features in SQL Server 2016  About me  General Enhancements  In-memory.
Redmond Protocols Plugfest 2016 Jos de Bruijn, Borko Novakovic SQL In-Memory OLTP Senior Program Manager.
Mladen Prajdić SQL Server MVP Hekaton The New SQL Server In-Memory OLTP Engine.
Advanced SQL - DDL Advanced Database Dr. AlaaEddin Almabhouh.
Doing fast! Optimizing Query performance with ColumnStore Indexes in SQL Server 2012 Margarita Naumova | SQL Master Academy.
Session Name Pelin ATICI SQL Premier Field Engineer.
New BI Features SQL 2016 New features of SQL 2016.
Introducing Hekaton The next step in SQL Server OLTP performance Mladen Prajdić
Use Cases for In-Memory OLTP Warner Chaves SQL MCM / MVP SQLTurbo.com Pythian.com.
Memory-Optimized Tables Querying at the speed of light.
Querying with Transact-SQL
In-Memory OLTP in SQL Server 2016 and Azure SQL Database
Standard/Express edition
In-Memory Capabilities
Temporal Databases Microsoft SQL Server 2016
Managing Tables, Data Integrity, Constraints by Adrienne Watt
Relational Database Design
Module 2: Creating Data Types and Tables
Temporal Databases Microsoft SQL Server 2016
SQL Server 2000 and Access 2000 limits
UFC #1433 In-Memory tables 2014 vs 2016
Taking your application to memory
Attributes and Domains
Oracle vs. MS SQL Server Duration: 1 Hour.
Ouch! Our Data Type Choices Did THAT?
SQL Implementation & Administration
SQL Server “In-Memory”
What is Database Administration
Graeme Malcolm | Data Technology Specialist, Content Master
මොඩියුල විශ්ලේෂණය Buffer Pool Extension භාවිතය.
Super Scaling The LMAX Queue Pattern.
Taking your application to memory
Proper DataType Usage = Guaranteed Better Performance and Accuracy
Taking your application to memory
What is your Character Data Type?
SQL 2014 In-Memory OLTP What, Why, and How
Working with Data Types
Introduction to partitioning
Database systems Lecture 2 – Data Types
Microsoft SQL Server 2014 for Oracle DBAs Module 7
PT2520 Unit 5: Physical Design
Data Types Do Matter Start local instance of SQL Start ZoomIt
What’s new with SQL Server
Statistics for beginners – In-Memory OLTP
SQL Server “In-Memory”
In-Memory OLTP for Database Developers
Attributes and Domains
Nifty trick to compress LOB data
SQL Server Columnar Storage
Presentation transcript:

Migrating a Disk-based Table to a Memory-optimized one in SQL Server

Compare Memory Optimized OLTP Table limitations between SQL Server 2014 and SQL Server 2016 Feature/Limit SQL Server 2014 SQL Server 2016 Maximum combined size of durable tables 256 GB 2 TB LOB (varbinary(max), [n]varchar(max)) Not supported Supported* Transparent Data Encryption (TDE) Supported Offline Checkpoint Threads 1 1 per container ALTER PROCEDURE / sp_recompile Supported (fully online) Nested native procedure calls Natively-compiled scalar UDFs ALTER TABLE Not supported (DROP / re-CREATE) Partially supported (offline – details below) DML triggers Partially supported (AFTER, natively compiled) Indexes on NULLable columns Non-BIN2 collations in index key columns Non-Latin codepages for [var]char columns Non-BIN2 comparison / sorting in native modules Foreign Keys Check/Unique Constraints Parallelism OUTER JOIN, OR, NOT, UNION [ALL], DISTINCT, EXISTS, IN Multiple Active Result Sets (MARS) (Means better Entity Framework support.) SSMS Table Designer

Prepare a database The database has to be created or altered (if exist) with one MEMORY_OPTIMIZED_DATA filegroup ALTER DATABASE [TestDB] ADD FILEGROUP [TestDBSampleDB_mod_fg] CONTAINS MEMORY_OPTIMIZED_DATA; ADD FILE (NAME='TestDB_mod_dir', FILENAME='C:\SQL2016\TestDB_mod_dir') TO FILEGROUP [TestDBSampleDB_mod_fg];

Differences between disk-based tables and memory-optimized tables MEMORY_OPTIMIZED property DURABILITY property - memory-optimized tables can be either: durable (SCHEMA_AND_DATA) non-durable (SCHEMA_ONLY) Indexes – no CLUSTERED indexes are implemented on memory-optimized tables. Indexes are not stored as traditional B-trees

Memory Optimized OLTP Table supported datatypes bit, tinyint, smallint, int, bigint. Numeric and decimal money and smallmoney float and real date/time types: datetime, smalldatetime, datetime2, date and time char(n), varchar(n), nchar(n), nvarchar(n), sysname, varchar(MAX) and nvarchar(MAX) binary(n), varbinary(n) and varbinary(MAX) uniqueidentifier The following data types are not supported: datetimeoffset, geography geometry hierarchyid rowversion xml sql_variant User-Defined Types and all legacy LOB data types (including text, ntext, and image)

Indexing memory-optimized tables There two types of memory optimized table indexes: • HASH • RANGE HASH index requires the user to specify the BUCKET_COUNT property value. The HASH indexes are more efficient with the equal (=) operator. The BUCKET_COUNT is calculated with the number of unique values multiplied by 2 for tables with fewer than 1 million rows, or multiplied by 1.5 for tables that have more than 1 million rows. RANGE indexes are optimized for the BETWEEN predicate. If are unsure of the number of buckets you’ll need for a particular column, or if you know you’ll be searching for your data based on a range of values, you should consider creating a range index instead of a hash index. Range indexes are implemented using a new data structure called a Bw-tree, originally envisioned and described by Microsoft Research in 2011. A Bw-tree is a lock- and latch-free variation of a B-tree.

SQL Server Features Not Supported for In-Memory OLTP Unsupported Feature Feature Description Data compression for memory-optimized tables. You can use the data compression feature to help compress the data inside a database, and to help reduce the size of the database. For more information, see Data Compression. Partitioning of memory-optimized tables. The data of partitioned tables and indexes is divided into units that can be spread across more than one filegroup in a database. For more information, see Partitioned Tables and Indexes. Replication Replication configurations other than transactional replication to memory-optimized tables on subscribers are incompatible with tables or views referencing memory-optimized tables. Replication using sync_mode=’database snapshot’ is not supported if there is a memory-optimized filegroup. For more information, see Replication to Memory-Optimized Table Subscribers. Multiple Active Result Sets (MARS) Multiple Active Result Sets (MARS) is not supported with memory-optimized tables. This error can also indicate linked server use. Linked server can use MARS. Linked servers are not supported with memory-optimized tables. Instead, connect directly to the server and database that hosts the memory-optimized tables. Linked Server For more information, see Linked Servers (Database Engine). DDL triggers Both database-level and server-level DDL triggers are not supported with In-Memory OLTP tables and natively compiled stored procedures. Database Containment Database containment is not supported in a database that has natively-compiled stored procedures and memory-optimized tables. For more information, see Contained Databases Context Connections Accessing memory-optimized tables using the context connection from inside CLR stored procedures is not supported. Cursors Keyset and dynamic cursors on queries accessing memory-optimized tables. These queries are degraded to static becoming read-only. TABLESTAMP TABLESTAMP is not supported. See FROM (Transact-SQL) for more information. Database Snapshots Database Snapshots are not supported. For more information, see Database Snapshots (SQL Server). Transactional DDL Transactional DDL is not supported in In-Memory OLTP.