Is there a performance hit using COUNT(*) over COUNT(attributeName) in T-SQL
            Asked
            
        
        
            Active
            
        
            Viewed 447 times
        
    2 Answers
3
            If attributeName is nullable, these are different constructs which yield different results, since COUNT() does not count NULL values.
The attributeName should be fetched and evaluated in the latter case.
If it's not (and defined as NOT NULL), then there is no performance difference and they are optimized to use the same plan.
        Quassnoi
        
- 413,100
 - 91
 - 616
 - 614
 
0
            
            
        They are different queries so performance shouldn't matter...
But COUNT only looks at NULL vs NON-NULL expressions