close
close

Count(*) Vs Count(1) Performance

Count(*) Vs Count(1) Performance. Just wondering if any of you people use count(1) over count(*) and if there is a noticeable difference in performance or if this is just a legacy habit that has been brought forward from days gone past? There’s a popular misconception that “1” in count(1) means “count the values in the first column and return the number of rows.” from that misconception follows a second:

Top Performance Tuning Tips for Windows Server 2012 R2
Top Performance Tuning Tips for Windows Server 2012 R2 from beta.petri.com

Count(1) is only subject to the same optimization if the first column is defined as not null. The star symbol is meaningless here, unlike its use in select *. The specific database is sql server 2005.

(more…)