Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Data Community - in memory oltp

222 views

Published on

Presentation given for Data Community User Group

Published in: Business
  • Be the first to comment

  • Be the first to like this

Data Community - in memory oltp

  1. 1. Katowice, 29.05.2017 Hekaton czyli o co chodzi w in-memory OLTP
  2. 2. Who is speaking? • Adrian Chodkowski • Data platform enthusiast… • Senior Business Intelligence Specialist at JCommerce • MCP, MCSA, MCSE:BI,MCSE: Data Management and Analytics • seequality.net • Adrian.Chodkowski@outlook.com • @Twitter: Adrian_SQL • LinkedIn: http://tinyurl.com/adrian-sql adrian.chodkowski@outlook.com
  3. 3. Why this topic? adrian.chodkowski@outlook.com
  4. 4. In-memory OLTP In Memory OLTP Native Compilation In-Memory Structures Lock/Latch Free Structures adrian.chodkowski@outlook.com
  5. 5. SQL Server – Disk based system • Optimized for storage subsystems • Durability • Everything happens in memory • Expensive IO • Locks • Contention 8KB 8KB 8KB 8KB 8KB 8KB 8KB 8KB8KB Extent Page adrian.chodkowski@outlook.com
  6. 6. Memory Optimized Table – Row Format Row Header Payload Begin TS End TS Stmt Id Indx Link Count Padding Index Pointers adrian.chodkowski@outlook.com
  7. 7. What’s the difference? Demo ! Data stored not in buffer pool No data pages & extents No disk activity during data reads Optimistic concurrency without tempdb No traditional indexes No mdf and ndf files – just checkpoint pairs adrian.chodkowski@outlook.com
  8. 8. Memory Optimized Tables • Rows are read and written to memory • Must be placed in special File group • Can be durable and non-durable • Disk is used only in DR scenarios and for logging • Accessed by native compiled SP’s and interpreted TSQL • Must contain 1 index • Possible to have 8 indexes Demo! adrian.chodkowski@outlook.com
  9. 9. Natively-compiled stored procedures • Compiled to native code (DLL) • Most efficient way to access Memory Optimized Tables • Can use only Memory optimized tables • Supports subset of TSQL  • No Parameter Sniffing (optimized for unknown) • Plan suport only few operators • Recompilations occur only on demand or during alter operation – may be needed after update statistics Demo! adrian.chodkowski@outlook.com
  10. 10. Indexes • Hashing alghoritm • Equal predicate • Singleton lookup • Buckets • Hash collision Hash Range • BW-Tree • Traditional-index like • Equal and not equal predicates • Range scans • Delta pages Range Should be your default choice! adrian.chodkowski@outlook.com
  11. 11. Hash index structure Timestamps Index ptr Name City 50, - null Jane Helsinki 70, - null Susan Vienna adrian.chodkowski@outlook.com
  12. 12. Hash index structure Timestamps Index ptr Name City 4 5 50, - null Jane Helsinki 70, - null Susan Vienna Hash index on Name adrian.chodkowski@outlook.com
  13. 13. Hash index structure Timestamps Index ptr Name City 4 5 50, - null Jane Helsinki 70, - null Susan Vienna 100, - Greg Beijing Hash index on Name INSERT INTO Customer(Name) VALUES(’Greg’) adrian.chodkowski@outlook.com
  14. 14. Hash index structure Timestamps Index ptr Name City 4 5 50, - null Jane Helsinki 70, - null Susan Vienna Źródło: Kalen Delaney 200, - Greg Lisbon 100, 200 Greg Beijing Hash index on Name UPDATE Customer SET City = ‘Lisbon’ WHERE Name=‘Greg’ adrian.chodkowski@outlook.com
  15. 15. Range index – BW Tree 0 1 2 3 4 5 6 Mapping table 5 8 10 10 20 11 15 18 1 2 4 200, - 1 50,300 2 PID 0 PID 3 PID 2 Key Key Data rows Root internal page internal page Demo! adrian.chodkowski@outlook.com
  16. 16. Scenarios to migrate • Session State systems • Lock/Latch contention • Concurrency problems • I/O problems • Transaction logging • ETL • OLTP workload – for OLAP use Columnstore, for hybrid (don’t?) use Operational Analytics scenarios adrian.chodkowski@outlook.com
  17. 17. Katowice, 29.06.2017 Hekaton czyli o co chodzi w in-memory OLTP Thank You! adrian.chodkowski@outlook.com

×