Re: count(*) vs count(id)

From: Matt Zagrabelny <mzagrabe(at)d(dot)umn(dot)edu>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Rob Sargent <robjsargent(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: count(*) vs count(id)
Date: 2021-02-02 02:31:31
Message-ID: CAOLfK3UqHe1urYNhmoT0wp=fx3mniNHaTqjmzJoiFu4jqBQOBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Feb 1, 2021 at 7:19 PM Guillaume Lelarge <guillaume(at)lelarge(dot)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(*) bigint number of input rows
count(expression) any bigint number of input rows for which the value of
expression is not null

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

-m

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2021-02-02 02:53:45 Re: libpq and mysterious "invalid byte sequence for encoding UTF8".
Previous Message rob stone 2021-02-02 01:52:05 Re: libpq and mysterious "invalid byte sequence for encoding UTF8".