Tuesday, June 14, 2011

Do not use select count(*) from table_name to find the number of rows in a table

If you have multi million/billion rows in your table. Do not use select count(*) from table_name to find the number of rows in a table instead you can try to use sp_spaceused 'table_name' It is much quicker than select count(*).

1 comment:

Dinesh Vishe said...

great 2768602 rows sowing in 9sec using select count(*)from table but same rows is showing 0 sec...thanks great ...