Posted By

tvanzele on 04/12/10


sql DMV

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Page and row-count information for every partition in the current database

 / Published in: SQL

  1. SELECT OBJECT_NAME(ps.[object_id]) AS [TableName],
  2. AS [IndexName], SUM(ps.row_count) AS [RowCount]
  3. FROM sys.dm_db_partition_stats AS ps
  4. INNER JOIN sys.indexes AS i
  5. ON i.[object_id] = ps.[object_id]
  6. AND i.index_id = ps.index_id
  7. WHERE i.type_desc IN ('CLUSTERED','HEAP')
  8. AND i.[object_id] > 100
  9. AND OBJECT_SCHEMA_NAME(ps.[object_id]) <> 'sys'
  10. GROUP BY ps.[object_id],
  11. ORDER BY SUM(ps.row_count) DESC;

Report this snippet  

You need to login to post a comment.