The system view
sys.partitions has a column "rows" that is the total number of rows in a given partition. For a table that is not partitioned (or only has one partition depending on how you look at it) this column gives the number of rows in the table.
I'm curious how accurate this column is and if I can use it instead of a
SELECT COUNT(1) FROM TableName. I've done some experiments where create a table and add a few thousand rows, delete a few hundred, add a few thousand more etc and the count has always been dead on. However I have one table with about 700 mil rows and several indexes. The row in
sys.partitions for the clustered index is again dead on, however the other indexes show some slight variations (+-20k).
Does anyone know how this row is calculated and if it is as accurate as it appears?