Delen via


Count(1) vs Count(*)

There has been a long-standing
doubt
about the performance of the count statement. I was told by experienced developers
in PL/SQL that using count(1) to find the rowcount was much more
high-performing than using count(*), as count(*) fetches all the rows
into memory before getting the exact count. I want to know whether this
holds true for T-SQL as well, or are the two just the same? I posted
this is msdn forums, and thanks to Rob Farley, I got a good answer. In
T-SQL, count(*) is good enough, but in PL/SQL, count(1) actually yields
better results.

Full thread - https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1242198&SiteID=1

Comments

  • Anonymous
    March 08, 2007
    You've been kicked (a good thing) - Trackback from DotNetKicks.com