Home Forums SQL Server 7,2000 T-SQL SELECT COUNT(*) or COUNT(1) Performance or Benefits? RE: SELECT COUNT(*) or COUNT(1) Performance or Benefits?

  • My first article at SQL Server Central discussed this: Advice on using COUNT( )

    As David says, COUNT(*) or COUNT(1) (or COUNT(9917456) or whatever) will be treated exactly the same way by the optimizer. They both simply say "count the number of rows in the set", so the optimizer is free to do that exactly as it whishes. The fastest way to count the number of rows in a table is to do a scan on the most narrow non-clustered index of the table, so that is that plan that will be chosen if possible.