HASH index (NONCLUSTERED) is a new type of index introduced in SQL Server 2014. It is only supported by memory optimized table. Recently, I was working on a memory optimized table and I came across in a situation where I had to find all the hash indexes available in the database. As usual I got it from a system view (sys.indexes). It is nothing new but the story did not end here because I found a shorter way to get the list of non-clustered hash indexes.
Given below is script that can give you the list of all hash indexes available in any particular database.
USE hkNorthwind GO SELECT object_schema_name([object_id]) As [Schema Name] , object_name([object_id]) As [Table Name] , [name] As [Index Name] , [type_desc] As [Index Description] FROM sys.hash_indexes --OUTPUT
Leave a Reply