Subject Re: COUNT(*) versus COUNT(primary_key)
Author Alexander V.Nevsky
--- In ib-support@yahoogroups.com, "Robert DiFalco" <rdifalco@t...>
wrote:
> In the case where these are functionally equivalent, is there any
> performance difference between the two that I should be aware of?

Robert, Count(column) should be a little slower than Count(*)
because first should check column values for NULL and don't count such
a rows. Don't think difference will be distinguished by human eye.
Note Count is one of slow operations because index can't be used even
if you count PK columns - engine should count rows which transaction
within which context statement run can see and this can be performed
only by visiting data pages. So I recommend to don't use it just with
decorative purposes - to show user that select return 30654 rows for
example, informativity is low and price is high. If you need to
determine just presence of rows complyed to some conditions, use
Exists instead of Count.

Best regards, Alexander.