Hi ,
This is a little off topic but I have seen count(*) on this list afew
times and it got me wondering...
Is there a reason to use SELECT COUNT(*) as opposed to SELECT COUNT(column)?
I have noticed that selecting count(*) versus specifying the column
name executes much more slowly.
I've
I believe the difference is that count(*) includes nulls (because it is
counting the number of records), whereas count(column) only counts the
records where the column being counted is not null, regardless of the
total number of rows.
Hmm, on a related question then if I am correct above, does
stipe42 wrote:
I believe the difference is that count(*) includes nulls (because it is
counting the number of records), whereas count(column) only counts the
records where the column being counted is not null, regardless of the
total number of rows.
Right. COUNT(*) counts rows, COUNT(col)