Quick table and index space used query - SimonS Blog on SQL Server Stuff

Quick table and index space used query

If running SQL 2005 or later you can use the following to get the pages and rows in an index

select OBJECT_NAME(p.object_id ), i.name,p.*

from sys.dm_db_partition_stats p

join sys.indexes i on i.object_id = p.object_id and i.index_id = p.index_id

Whats good about this is that it gives in row, out of row and overflow pages with the number used and reserved pages

 



-
Published 23 September 2008 14:08 by simonsabin

Comments

No Comments