Re: count(*) vs count(id) - Mailing list pgsql-general

From aNullValue (Drew Stemen)
Subject Re: count(*) vs count(id)
Date
Msg-id 201e6c65-2d90-44f0-8b72-75cc5d9f36fd@www.fastmail.com
Whole thread Raw
In response to Re: count(*) vs count(id)  (Matt Zagrabelny <mzagrabe@d.umn.edu>)
List pgsql-general
At 2021-02-01T20:14:04-05:00, Matt Zagrabelny <mzagrabe@d.umn.edu> sent:
select count(id) from call_records where id is null;
 count
═══════
     0
(1 row)

Time: 0.673 ms

Which field is count(*) counting if it is counting nulls?

-m

What you're overlooking is that, at least to my reading of your original query, id would be null for any dates that do not have any corresponding call_records (because you used a left join).

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: count(*) vs count(id)
Next
From: Guillaume Lelarge
Date:
Subject: Re: count(*) vs count(id)