Advertisement
Beginner SQL Server, In-Memory OLTP (Memory-Optimized Tables)

What is In-Memory OLTP in SQL Server, and what performance benefit does it provide?

Short answer

In-Memory OLTP lets you create memory optimized tables that are held entirely in memory rather than on disk, using a different internal engine specifically designed for extremely fast data access, which can dramatically improve performance for workloads with very high numbers of…

Save SQL Server mock interview
Advertisement
AModel answer
In-Memory OLTP lets you create memory optimized tables that are held entirely in memory rather than on disk, using a different internal engine specifically designed for extremely fast data access, which can dramatically improve performance for workloads with very high numbers of concurrent transactions.
CREATE TABLE SessionData (
  SessionId INT PRIMARY KEY NONCLUSTERED,
  UserId INT,
  LastActivity DATETIME2
) WITH (MEMORY_OPTIMIZED = ON);
Real-world example
A high traffic gaming platform stores temporary session data in a memory optimized table, handling a massive number of rapid reads and writes per second that would be much slower using traditional disk based tables.
Likely follow-ups
  • Does data in a memory optimized table survive a server restart?
  • What kinds of workloads benefit the most from In-Memory OLTP?
Related topics