January 26, 2011 at 9:27 am
Why we will use sum(row_count) from sys.dm_db_partition_stats instead of using row_count from sys.dm_db_partition_stats because i verified both the results are same.
Detailed:
why we use the below query to get row count
(SELECT Sum(row_count)
FROM sys.dm_db_partition_stats
WHERE OBJECT_ID = OBJECT_ID('testu'))
instead of
(SELECT (row_count)
FROM sys.dm_db_partition_stats
WHERE OBJECT_ID = OBJECT_ID('testu'))
January 26, 2011 at 9:47 am
are you testing this against a database with only one partition?
I suspect the SUM is to account for databases with multiple partitions
January 26, 2011 at 10:11 am
I don't know how many paritions but thanks for ur reply
So one Database can have multiple partitions ?
January 26, 2011 at 10:20 am
Your query is wrong. Add the predicate index_id IN (0,1) or you'll get multiples of the row count if there are any nonclustered indexes.
One row per table, per index, per partition.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
January 26, 2011 at 10:24 am
Thank you
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy