Re: count(*) vs count(id)

Поиск
Список
Период
Сортировка
От aNullValue (Drew Stemen)
Тема Re: count(*) vs count(id)
Дата
Msg-id 201e6c65-2d90-44f0-8b72-75cc5d9f36fd@www.fastmail.com
обсуждение исходный текст
Ответ на Re: count(*) vs count(id)  (Matt Zagrabelny <mzagrabe@d.umn.edu>)
Список 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 по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: count(*) vs count(id)
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: count(*) vs count(id)