Stuart McLachlan
stuart at lexacorp.com.pg
Fri Aug 20 20:18:04 CDT 2004
On 20 Aug 2004 at 20:24, Arthur Fuller wrote: > I can't verify the internals but I agree with your suggestion. Almost > all SQL books suggest that Count(*) is highly optimized while > Count(MyField) is not. > Just can across another trick to do it much faster still: There is another way to determine the total row count in a table. You can use the sysindexes system table for this purpose. There is ROWS column in the sysindexes table. This column contains the total row count for each table in your database. So, you can use the following select statement instead of above one: SELECT rows FROM sysindexes WHERE id = OBJECT_ID('table_name') AND indid < 2 -- Stuart