Wednesday, July 29, 2009

Getting the total row count of a table without count()

The count(*) or count(pk) will be slow for large tables.

The alternate way to archive this as fast

Mssql-2000

SELECT rows
FROM sysindexes
WHERE object_name(id) = 'table_name'
AND indid =0


Mssql -2005 or more

SP_SPACEUSED table_name

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.