pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matt Zagrabelny <mzagrabe@d.umn.edu>
Cc: Rob Sargent <robjsargent@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: count(*) vs count(id)
Date: Mon, 01 Feb 2021 19:34:58 -0500
Message-ID: <3502043.1612226098@sss.pgh.pa.us> (raw)
In-Reply-To: <CAOLfK3W99Cdf9Sq+XyJv5MAjp9wsYBKpAC2UAVp7+dB881KmjQ@mail.gmail.com>
References: <CAOLfK3VWa_Mv3OSumvpHZdppd+qDj8EUWCdxY5+vUe=gAo+h0A@mail.gmail.com>
	<cb465259-e29a-8fc2-1890-2666b8d79f36@gmail.com>
	<CAOLfK3W99Cdf9Sq+XyJv5MAjp9wsYBKpAC2UAVp7+dB881KmjQ@mail.gmail.com>

Matt Zagrabelny <mzagrabe@d.umn.edu> writes:
> On Mon, Feb 1, 2021 at 5:57 PM Rob Sargent <robjsargent@gmail.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





view thread (14+ messages)  latest in thread

Message-ID: <3502043.1612226098@sss.pgh.pa.us>
Permalink:  ../3502043.1612226098@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3502043.1612226098@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mzagrabe@d.umn.edu, robjsargent@gmail.com
  Subject: Re: count(*) vs count(id)
  In-Reply-To: <3502043.1612226098@sss.pgh.pa.us>
  References: <CAOLfK3VWa_Mv3OSumvpHZdppd+qDj8EUWCdxY5+vUe=gAo+h0A@mail.gmail.com> <cb465259-e29a-8fc2-1890-2666b8d79f36@gmail.com> <CAOLfK3W99Cdf9Sq+XyJv5MAjp9wsYBKpAC2UAVp7+dB881KmjQ@mail.gmail.com> <3502043.1612226098@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox