Optimized way to get count of rows from a table

 

To get no. of rows from a table we usually use query

Select count(*) from table_name

But this query reads complete table to return no. of

Optimized way for performing this query is

Select rows from sysindexes where id= Object_Id(‘table_name’)

Technorati Tags:

Popular posts from this blog

Cross Apply Incorrect syntax near '.'

SQL Server 2005 - Showing ResultSet in a Single Row OR in a comma separated string format.

Alert : can not set credentials for principal sa