Search Postgresql Archives

Re: count(*) vs count(id)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 2021-02-01T20:14:04-05:00, Matt Zagrabelny <mzagrabe@xxxxxxxxx> 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).

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux