SELECT COUNT(*) vs COUNT(1) vs COUNT(ColumnName)

Who is online?  0 guests and 0 members
Home  »  Blogs  »  BradSchacht  »  SELECT COUNT(*) vs COUNT(1) vs COUNT(ColumnName)
 
0
/5
Avg: 0/5: (0 votes)

Comments (1)

stirone
stirone said:
I'm not so sure COUNT(*) and COUNT(1) are the same. I definitely had a situation recently where COUNT(1) ran significantly faster than COUNT(*) -- I'll have to look around for that example for the details. I read somewhere that COUNT(*) lets the optimizer pick the most favorable column for providing a count. Don't know if that helps distinguish the diffs, but thought I would mention it. I'll see if I can find that COUNT(1) usage somewhere when I get back to work on Monday...
9/25/2011
 · 
 
by
Blogs RSS Feed

BradSchacht's latest blog posts

Blogs RSS Feed

Latest community blog posts