Search This Blog

Wednesday 7 January 2015

Find Heap Tables in your sql database

Tip #4 Find Heap Tables in your sql database.

I am posting some of the most useful queries which help a dba/ developer to optimize database performance. Please reference to different Tips in other blogs as well.

Following query will help in determining the heap Tables in Sql database. Some people may not be aware of: What are Heap Tables?

Heaps (Tables without Clustered Indexes): A heap is a table without a clustered index. One or more non clustered indexes can be created on tables which can be stored as a heap. Data which is stored in heap, is without specifying any order.

Run the following query in your sql server query window:

SELECT T.NAME 'Heaptable'
FROM sys.indexes I
INNER JOIN sys.tables T
 ON I.object_id = T.object_id
WHERE I.type = 0
 AND T.type = 'U'

No comments:

Post a Comment

Enter your comments here...