Page 8
same memory-optimized algorithms and data structures as memory-optimized tables—
particularly when using natively compiled stored procedures.
Natively compiled stored procedures: SQL Server can natively compile stored procedures that
access memory-optimized tables. Native compilation enables faster data access and more
efficient query execution than interpreted (traditional) Transact-SQL. Natively compiled stored
procedures are parsed and compiled when they are loaded to native DLLs (dynamic-link libraries).
This is in contrast to other stored procedures that are compiled on first run. They have an
execution plan created and reused, and they use an interpreter for execution.
Natively compiled scalar user-defined functions (UDFs): These replace traditional scalar UDFs
that do not perform data access, and this replacement reduces UDF runtime. Natively compiled
scalar UDFs cannot access disk-based tables. If data access is required, consider migrating the
table to memory-optimized (if no data access occurs, migration is not required).
In-Memory OLTP is designed on the following architectural principles:
Optimize for main-memory data access. Storage-optimized engines (such as the current OLTP
engine in SQL Server) will retain hot data in a main-memory buffer pool based on frequency of
access. The data access and modification capabilities, however, are designed so that data may be
paged in or out to disk at any point. With In-Memory OLTP, you place tables used in the extreme
transaction-processing portion of an application into memory-optimized main-memory
structures. The remaining application tables, such as reference data details or historical data, are
left in traditional storage-optimized structures. This approach enables you to optimize hotspots
for memory use, without having to manage multiple data engines. Main-memory structures for
In-Memory OLTP eliminate the overhead and indirection of the storage-optimized view while still
providing the full atomicity, consistency, isolation, and durability (ACID) properties you expect
from a database system.
Include tools for migration. To identify the appropriate tables and memory structures for
utilizing In-Memory OLTP, SQL Server 2016 Management Studio includes tools designed to assist
users in transitioning to In-Memory OLTP. These include transaction performance analysis to
identify objects that would benefit from migration, migration advisors to assist in migrating disk-
based tables to memory-optimized tables, and migration of traditional stored procedures and
functions to natively compiled objects.
Accelerate business-logic processing. In-Memory OLTP, queries, and procedural logic in
procedures that are stored in Transact-SQL (T-SQL) are compiled directly into machine code
through aggressive optimizations that are applied at compilation time. Consequently, the stored
procedure can be executed at the speed of native code.
Provide frictionless scale-up. In-Memory OLTP implements a highly scalable concurrency
control mechanism and uses a series of lock-free data structures to eliminate traditional locks and
latches while guaranteeing the correct transactional semantics that ensure data consistency.
Integrate into SQL Server. One of the most impressive things about In-Memory OLTP is that it
achieves breakthrough improvements in transactional processing capabilities without requiring a
separate data management product or new programming model. This enables an integrated
developer and database administrator (DBA) experience with the same T-SQL, client stack,
tooling, backup and restore, and AlwaysOn capabilities. By offering in-memory functionality