Overview

Following on from my previous post, here's a quick way to find out which data tables are using the most disk space...

References

Solution

SELECT o.name AS table_name, SUM(au.data_pages) as pages,
       ((SUM(au.data_pages) * 8192) / (1024 * 1024)) AS MB
FROM sys.allocation_units AS au
     JOIN sys.partitions AS p ON au.container_id = p.partition_id
     JOIN sys.tables AS o ON p.object_id = o.object_id
     JOIN sys.indexes AS i ON p.index_id = i.index_id AND i.object_id = p.object_id
GROUP BY o.name
ORDER BY pages desc, o.name
GO

Versions

Metadata


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
posted @ Wednesday, January 09, 2008 3:16 PM | in SQL Server Software Development IT Management

Comments

No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  


Please add 3 and 7 and type the answer here: