Re: count(*) vs count(id)

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: count(*) vs count(id)
Дата
Msg-id CAKFQuwa2ki4CyncgrMWqR8aewxfhPjtXX4fy+89yrWsDms+Upg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: count(*) vs count(id)  (Matt Zagrabelny <mzagrabe@d.umn.edu>)
Список pgsql-general
On Mon, Feb 1, 2021 at 6:14 PM Matt Zagrabelny <mzagrabe@d.umn.edu> wrote:
Which field is count(*) counting if it is counting nulls?

count(id) excludes from the count rows where the id field is null.  The presence of a left join in your query is introducing a null here due to there not being a related field, not because the id value in a table is actually null.

David J.

В списке pgsql-general по дате отправления:

Предыдущее
От: Matt Zagrabelny
Дата:
Сообщение: Re: count(*) vs count(id)
Следующее
От: "aNullValue (Drew Stemen)"
Дата:
Сообщение: Re: count(*) vs count(id)