Re: count(*) vs count(id)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matt Zagrabelny <mzagrabe(at)d(dot)umn(dot)edu>
Cc: 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 00:34:58
Message-ID: 3502043.1612226098@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Matt Zagrabelny <mzagrabe(at)d(dot)umn(dot)edu> writes:
> On Mon, Feb 1, 2021 at 5:57 PM Rob Sargent <robjsargent(at)gmail(dot)com> wrote:
>> You got one null from count(*) likely.

> What is count(*) counting then? I thought it was rows.

Yeah, but count(id) only counts rows where id isn't null.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matt Zagrabelny 2021-02-02 01:14:04 Re: count(*) vs count(id)
Previous Message Matt Zagrabelny 2021-02-02 00:32:18 Re: count(*) vs count(id)