January 25, 2013 at 8:38 am
I was looking this morning for a way to find the row count of all of the tables in one of our databases. I stumbled upon this query:
SELECT OBJECT_NAME(OBJECT_ID) TableName, st.row_count
FROM sys.dm_db_partition_stats st
WHERE index_id < 2
ORDER BY st.row_count DESC
It seems to work really well. However, I don't understand the index_id in this table (sys.dm_db_partition_stats). Does anyone have an explanation for the purpose of this table and what this index_id is referring to? MSDN says:
ID of the heap or index the partition is part of.
0 = Heap
1 = Clustered index.
> 1 = Nonclustered index
But that was Greek to me! I'm really interested in learning, so any light on the subject is appreciated.
January 25, 2013 at 8:47 am
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply