开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜