Select Page

Hekaton Helps Build Faster Databases In 3 Ways (Part 1)

Author: Andy McDermid | | December 23, 2013

In SQL Server 2014 Microsoft introduces In-Memory-OLTP, also known as Hekaton. This technology allows the DBA to configure a specific table to reside in memory full time. Of course, if the data is always in memory we can count on increased throughput since we’ll never have to go to disk for that data.

But wait – if your server has enough RAM your instance may be running with a good part of the database already persistent in-memory, so you might be thinking; ‘Hekaton -what is the big deal’?

In fact, there is a lot more going on than what you’d see in an IMDB. In-Memory-OLTP is an entirely new SQL engine standing side-by-side with, and more-or-less seamlessly integrated with the ‘old’ standard engine. Rather than pinning a table in the buffer pool (no, it is not just a technology recycle of DBCC PINTABLE) and settling for the performance improvements associated with reduced disk IO, In-Memory-OLTP has, broadly, three ways help your database perform faster. To get an overview of the feature, and to see just where it can improve performance, let’s take a look at each of these facets and compare and contrast the new In-Memory to the traditional disk-based functionality.

LOG Writes
In a disk-based system when any changes made to a data page in the buffer pool (update, delete, etc.) SQL Server must carefully ensure the changes are durable in case of a system crash. It does this via Write-Ahead-Logging, which ensures that the changes are hardened to disk in the transaction log before the transaction is committed. Then the changed page is marked as dirty and the next checkpoint flushes it to disk.

There is a bit more to it though, since each change recorded in the log must also include a corresponding undo record in case the transaction rolls-back or the system crashes before the transaction commits. Furthermore, if the changed data has any associated indexes, those too must be updated and will create additional log records.

Depending on the disk sub-system where the transaction log resides we might just expect to see some WRITELOG and LOGBUFFER waits.

To understand how In-Memory-OLTP side-steps these potential issues, first things first, set aside your understanding of the buffer pool as a repository of logical 8KB data pages. There is no concept of data pages in In-Memory-OLTP and there is no buffer pool as a logical intermediary between the transaction and the disk. Rather we have rows addressed to physical memory and associated via a hash-index. Whereas in disk-based systems SQL Server uses the transaction log to ensure durability in the gap between a data page change and that page being persisted to disk, In-Memory-OLTP simply waits until the transaction commits and the row is changed, then records the change to the transaction log. In-Memory-OLTP maintains durability but there is no gap and therefore no need for undo information in the transaction log. As for the indexes, they do still get updated, but since In-Memory-OLTP recreates these on every database start up, it does not bother to record those changes to the transaction log.

Last, but not least, In-Memory-OLTP employs a new method to consolidate log records. Whereas a disk based system may log a record (at least) for each row changed, In-Memory-OLTP can consolidate many changes into a single log record.

Taken together this all results in some serious streamlining for transaction log writes. It’s still best practice to put your log records onto the fastest write disk available, SSD if possible. Especially since there is still only one transaction log per database (In-Memory-OLTP transactions share the log with disk-based transactions, they both write to the same old transaction log). But given a decent write speed, and an appropriate design for in-memory tables, we might not see those Log Wait stats around so much anymore.

Keep an eye out here for posts on two additional ways Hekaton helps build faster databases: by reducing latching, locking and blocking and by optimizing CPU time.
To learn more about In-Memory OLTP you can get a start reading Microsoft’s data platform Blog here.

How to Solve the Oracle Error ORA-12154: TNS:could not resolve the connect identifier specified

The “ORA-12154: TNS Oracle error message is very common for database administrators. Learn how to diagnose & resolve this common issue here today.

Vijay Muthu | February 4, 2021

Data Types: The Importance of Choosing the Correct Data Type

Most DBAs have struggled with the pros and cons of choosing one data type over another. This blog post discusses different situations.

Craig Mullins | October 11, 2017

How to Recover a Table from an Oracle 12c RMAN Backup

Our database experts explain how to recover and restore a table from an Oracle 12c RMAN Backup with this step-by-step blog. Read more.

Megan Elphingstone | February 2, 2017

Subscribe to Our Blog

Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.

CONTACT US

Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.

EXPLORE JOBS