开发者

Is there a performance hit using COUNT(*) over COUNT(attributeName) in T-SQL

开发者 https://www.devze.com 2023-02-20 14:20 出处:网络
Is there a performance hit using COUNT(*) over COUNT开发者_StackOverflow社区(attributeName) in T-SQLIf attributeName is nullable, these are different constructs which yield different results, since CO

Is there a performance hit using COUNT(*) over COUNT开发者_StackOverflow社区(attributeName) in T-SQL


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.


They are different queries so performance shouldn't matter...

But COUNT only looks at NULL vs NON-NULL expressions

0

精彩评论

暂无评论...
验证码 换一张
取 消