Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6jev-00019n-6T for pgsql-general@arkaria.postgresql.org; Tue, 02 Feb 2021 00:35:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l6jeu-0002UF-55 for pgsql-general@arkaria.postgresql.org; Tue, 02 Feb 2021 00:35:08 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6jet-0002U8-UH for pgsql-general@lists.postgresql.org; Tue, 02 Feb 2021 00:35:07 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6jep-0002CM-CN for pgsql-general@lists.postgresql.org; Tue, 02 Feb 2021 00:35:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 1120YwCZ3502044; Mon, 1 Feb 2021 19:34:58 -0500 From: Tom Lane To: Matt Zagrabelny cc: Rob Sargent , "pgsql-generallists.postgresql.org" Subject: Re: count(*) vs count(id) In-reply-to: References: Comments: In-reply-to Matt Zagrabelny message dated "Mon, 01 Feb 2021 18:32:18 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3502042.1612226098.1@sss.pgh.pa.us> Date: Mon, 01 Feb 2021 19:34:58 -0500 Message-ID: <3502043.1612226098@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Matt Zagrabelny writes: > On Mon, Feb 1, 2021 at 5:57 PM Rob Sargent 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