Examining Hekaton Code

In my previous post, I made reference to a Microsoft Research paper on Hekaton Internals. This states that the SQL Engine produces C code which is then compiled to a DLL. So that would leave you to the assumption that there is a C file somewhere that can be looked at to find out some more about Hekaton, its internals and how it processes data. Well there is J

Under the directory ‘C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\xtp‘ (assuming that you have installed SQL Server itself to C:, there will be some subdirectories, that is , one further assumption, that you have compiled at least one natively compiled stored procedure. The folders here are the databaseids. In them you will find a series of files with the naming convention of : xtp_p_5_629577281. 5 here being the databaseid and 629577281 being the procedures’ object id.

The file of most interest is the .c file, the C code itself. The .MAT file is the required metadata for the procedure.

Have fun reading the C code, it can make your ears bleed, remember that this code is not meant for human consumption.

Reading this code can give you an insight into what operations the engine is going to perform on your behalf in much the same way that a query plan would.  In CTP1 there is no execution plan for compiled code but as Ben Nevarez blogs here ( http://www.benjaminnevarez.com/2013/07/hekaton-transforming-query-plans-into-c-code/ ) they are coming, so in time we wont have to go to C files for that.

Have fun….

Leave a Reply

Your email address will not be published. Required fields are marked *