Try executing the below queries in a table containing millins of records. Both the queries yields row count of the table, but the performance of Query 1 is more.
Query 1:
SELECT SUM(row_count) FROM Sys.dm_db_partition_stats
WHERE OBJECT_ID = OBJECT_ID('AccountCommunications')
AND (index_id =0 or index_id =1);
Query 2:
Select COUNT(*) From dbo.AccountCommunications
No comments:
Post a Comment