SQL SERVER – How to Find the In-Memory OLTP Tables Memory Usage on the Server

When I presented at the SQLPASS this year there were several learning that I found it interesting. Every year, this presentation preparation is something I take it seriously. I know many them turn up to learn some new tricks every single year. Hence, I invest considerable amount of time to prepare. This year I showcased several tips and tricks involving SQL Server In-Memory OLTP capability. I personally feel this feature is lesser known and never appreciated. As I was doing the session, one of the DBA asked how to find out the memory utilization of various In-Memory OLTP tables.

During the break session, I showed how the DMVs can be used to collect this important information. These have been around for a while, but not known. Here is a simple script to show the same:

SELECT object_name(object_id) AS Name, *  
FROM sys.dm_db_xtp_table_memory_stats

As you can see, this is run against the database and the script will list all the tables and their memory utilization on the server. The output will look like below:

SQL SERVER - How to Find the In-Memory OLTP Tables Memory Usage on the Server adworks_InMemory-Steps-01-800x275

You will need to add the memory used by the table and the memory allocated for indexes to get a clear idea on what the overall memory utilization is for the given table.

As I try to wrap up this simple blog, please let me know how you are using In-Memory OLTP features? What is the largest table on your production environments using this feature? Do let us know via comments and share your experience with all on using this feature.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Exit mobile version