Hekaton is Microsoft SQL Server's in-memory OLTP engine. It allows for creating memory-optimized tables to fully leverage RAM and provide faster performance than disk-based tables. Memory-optimized tables use new row formats and indexing structures like hash and range indexes that are optimized for memory. Stored procedures can be natively compiled for maximum speed when operating on memory-optimized tables. There are some limitations around data types and features supported. Diagnostic objects like DMVs provide visibility into Hekaton's memory usage and performance.
15. Natively Compiled Procs
CREATE PROCEDURE [dbo].[InsertOrder] @id INT, @date DATETIME
WITH
NATIVE_COMPILATION,
SCHEMABINDING,
EXECUTE AS OWNER
AS
BEGIN ATOMIC
WITH
(TRANSACTION
ISOLATION LEVEL = SNAPSHOT,
LANGUAGE = N'us_english')
-- insert T-SQL here
END
16. Limitations
Only In MEM tables
No OUTER JOIN, no DISTINCT no OR, no subqueries, no CASE
Limited built-in functions
BUT:
Fastest way!
Good news : Interface will be expanded in next version
19. Diagnostics
All starting with sys.dm_db_xtpDMO
•sys.dm_db_xtp_checkpoint_files
•sys.dm_db_xtp_table_memory_stats
•Sys.dm_db_xtp_index_stats
XEvents
•From SYS.dm_xe_objects O JOIN SYS.dm.xe_packages P on O.package_guid = P.guid where P.name = ‘XtpEngine’
Perfomance Counters
•From sys.dm_os_performance_counters where object_name like ‘XTP%’
20. Keep In Mind
Data in memory at all times
Still using log files
Do not exceed 256 GB of InMem table
25. A SQL query walks into a bar and sees two tables.
He walks up to them and says 'Can I join you?
The SQL query found the table by doing a full scan of the
other tables…
In the meanwhile, the waitress arrived at the table.
Woohoow what a nice view…