Can ever selet count(*) be faster that select *

  • I have come across a case where "select count(*) " is way slower than " select * from my view order by id ", i will provide more details, but i am curious to know how could count(*) be faster.

  • Count(*) can easily be faster than select *. Firstly SQL will use the smallest index on that table (assuming no where clause). Second, less data to transmit.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply