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 1l6kKg-0003ED-6p for pgsql-general@arkaria.postgresql.org; Tue, 02 Feb 2021 01:18:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l6kKf-000156-4z for pgsql-general@arkaria.postgresql.org; Tue, 02 Feb 2021 01:18:17 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6kKe-00013j-Bw for pgsql-general@lists.postgresql.org; Tue, 02 Feb 2021 01:18:16 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6kKc-00021e-3a for pgsql-general@lists.postgresql.org; Tue, 02 Feb 2021 01:18:15 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 632AEEB8 for ; Mon, 1 Feb 2021 20:18:12 -0500 (EST) Received: from imap8 ([10.202.2.58]) by compute3.internal (MEProxy); Mon, 01 Feb 2021 20:18:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anullvalue.net; h=mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm2; bh=Xj/djCMC7RK1f6tXCeiTXlNnGdc7MsI uImtclVRYrHY=; b=imGQr76P4BuppInVgCdKs/+9RZ2tJDfouHbmIs0EJQQPzsm 0ON8609RYA5tLXsBNYh0v9sieZlokS3rn7kXlG+oAertDt39bDme3z78H+BZvTrb ylhjHBC9Cfkuc7dkFPXYKfrHbEeOfLLjNtyki4pSq07Tjqmw41GokCZA9tLEn/6s AvK3PFl26xHkTtYmO8lnYZl3Y5XM/PRBTvlzyqc48zHlBdzUqVrhbAMhNT4sMXvb Yzr8JXJxn09YJyTYGTCHPmDvEQtHkCQhqXy+QNHtlUPa1rQ5s4+Qu896BDaD2ogv 81UfCCKQhccvQV0KmQsLO8/AhuHywobzmntx08w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Xj/djC MC7RK1f6tXCeiTXlNnGdc7MsIuImtclVRYrHY=; b=g+6n2u2nDcZgd9UNUn2Vxj rJFmICjE+DGEaVGrx9F1QHIUgr8WaHTUNVzCdh/q6NmaUodTzbGINLSbBlqnEt+1 RI+yXqNV5gUfX9q5QPW0e2r/jv6FkkaFBbq87+eCc+VA+s7lCs9AHO/CQgWWAGDI e2BbsXzBaturO1Aogkx/mVXNikS8XeApxZZ+JoKrYE04ZROVlY1O40nT+TJ+3Ls1 K5sUjJoe+pkyxJU2qXaMLBcfl+guUdpulhgKsZhIfFelroHlHg7zt8bi6CPCUZWv EUb3qDJIRjnouB17xCoIuK3c2JbNf2uuBYzTT6QfDplC/ZLsUpCE5ts25qpYqLkA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeelgddviecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkjghffffhvffutgesrgdtre erreerjeenucfhrhhomhepfdgrpfhulhhlgggrlhhuvgculdffrhgvficuufhtvghmvghn mddfuceoughrvgifsegrnhhulhhlvhgrlhhuvgdrnhgvtheqnecuggftrfgrthhtvghrnh epveehhfekheevvdefueehteeitdfhtddtudekueelveegtdeutdethfeijeetvdfhnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepughrvgifse grnhhulhhlvhgrlhhuvgdrnhgvth X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 72A103A0074; Mon, 1 Feb 2021 20:18:11 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-93-gef6c4048e6-fm-20210128.002-gef6c4048 Mime-Version: 1.0 Message-Id: <201e6c65-2d90-44f0-8b72-75cc5d9f36fd@www.fastmail.com> In-Reply-To: References: <3502043.1612226098@sss.pgh.pa.us> Date: Mon, 01 Feb 2021 20:17:50 -0500 From: "aNullValue (Drew Stemen)" To: pgsql-general@lists.postgresql.org Subject: Re: count(*) vs count(id) Content-Type: multipart/alternative; boundary=de6681bd73674f3a91fae626a2e924c8 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --de6681bd73674f3a91fae626a2e924c8 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable At 2021-02-01T20:14:04-05:00, Matt Zagrabelny sent:= > select count(id) from call_records where id is null; > count=20 > =E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90 > 0 > (1 row) >=20 > Time: 0.673 ms >=20 > Which field is count(*) counting if it is counting nulls? >=20 > -m What you're overlooking is that, at least to my reading of your original= query, id would be null for any dates that do not have any correspondin= g call_records (because you used a left join).=20 --de6681bd73674f3a91fae626a2e924c8 Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable
At 2021-02-01T2= 0:14:04-05:00, Matt Zagrabelny <mzagrabe@d.umn.edu> sent:
select count(id) from call_records where id is null;
&nbs= p;count
=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95=90=E2=95= =90=E2=95=90
     0
(1 row)

Time: 0.673 ms

Which field is count(*) counting if it is counting nulls?

-m

What you're overlooking is that, at least to my reading of your or= iginal query, id would be null for any dates that do not have any corres= ponding call_records (because you used a left join).
--de6681bd73674f3a91fae626a2e924c8--