Search Postgresql Archives

Re: count(*) vs count(id)

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

 



On Mon, Feb 1, 2021 at 6:14 PM Matt Zagrabelny <mzagrabe@xxxxxxxxx> 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.

[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