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

From Matt Zagrabelny
Subject Re: count(*) vs count(id)
Date
Msg-id CAOLfK3UqHe1urYNhmoT0wp=fx3mniNHaTqjmzJoiFu4jqBQOBw@mail.gmail.com
Whole thread Raw
In response to Re: count(*) vs count(id)  (Guillaume Lelarge <guillaume@lelarge.info>)
List pgsql-general


On Mon, Feb 1, 2021 at 7:19 PM Guillaume Lelarge <guillaume@lelarge.info> wrote:


You're doing a left join, so I guess there's no row where call_records.timestamp::date = 2020-08-30. That would result with a NULL id.


Thanks for the excellent analysis everyone. I appreciate it!

Here is the documentation (for anyone reading the mailing list in the future...)

count(*) bigintnumber of input rows
count(expression)anybigintnumber of input rows for which the value of expression is not null

Have a great night (or equivalent for your TZ).

-m

pgsql-general by date:

Previous
From: rob stone
Date:
Subject: Re: libpq and mysterious "invalid byte sequence for encoding UTF8".
Next
From: Tom Lane
Date:
Subject: Re: libpq and mysterious "invalid byte sequence for encoding UTF8".