Breaking News
Loading...
28/08/2013

The advantage of Heap table SQL Server

A heap is a table that does not have a clustered index and, therefore, the pages are not linked by pointers. The IAM pages are the only structures that link the pages in a table together. Unindexed tables are good for fast storing of data. Many times it is better to drop all indexes from table and than do bulk of inserts and to restore those indexes after that.
Ref: Heap Structures - http://msdn.microsoft.com/en-us/library/ms188270%28v=sql.100%29.aspx

Here is the script to find out all heap tables in a specific database:
SELECT TOP 1000 o.name, i.type_desc, o.type_desc, o.create_date
FROM sys.indexes i
INNER JOIN sys.objects o
 ON  i.object_id = o.object_id
WHERE o.type_desc = 'USER_TABLE'
AND i.type_desc = 'HEAP'
ORDER BY o.name
GO

Refer: http://www.mssqltips.com/sqlservertip/2510/sql-server-tables-without-a-clustered-index/

0 comments:

Post a Comment

 
Toggle Footer