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

/ Published in: SQL
Save to your folder(s)

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.