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 1pS410-00064F-PK for pgsql-general@arkaria.postgresql.org; Tue, 14 Feb 2023 22:43:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pS40z-00060n-DA for pgsql-general@arkaria.postgresql.org; Tue, 14 Feb 2023 22:43:09 +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 1pS40z-00060e-2V for pgsql-general@lists.postgresql.org; Tue, 14 Feb 2023 22:43:09 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pS40w-0002tm-I6 for pgsql-general@lists.postgresql.org; Tue, 14 Feb 2023 22:43:08 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id DD66C15CA5; Tue, 14 Feb 2023 23:43:04 +0100 (CET) Date: Tue, 14 Feb 2023 23:43:04 +0100 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: Query plan for "id IS NULL" on PK Message-ID: <20230214224304.ykdgobmkqpaygbth@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: <8e622f19-bc95-eac3-188d-b03734f547f6@gmail.com> <8e744026-7547-5d4d-b76c-ca152881ccce@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="z2e7mqe5e3kn4cny" Content-Disposition: inline In-Reply-To: <8e744026-7547-5d4d-b76c-ca152881ccce@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --z2e7mqe5e3kn4cny Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2023-02-14 15:36:32 -0700, Rob Sargent wrote: > But if the query is supposed to be generic and re-used in a situation whe= re id > could be null, wouldn't the null id records be fetched every time?=A0 No, they will never be fetched because of the AND (("id" <=3D ?)). hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --z2e7mqe5e3kn4cny Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmPsDngACgkQ8g5IURL+ KF2ZoBAAgkS04EkWBQS9hBr1pWsSMX3GhE/kRQljG5IYXRe4bFBnhe0TRvURrJIO BAvoeaK+qmswIvz+Ot+dejWViLjOgkyvoARmCj2m64gLyyKI0atZ8KW8cYkaxE9H inoRAJBmOdPau+NTnLlXSHQTeQQ7xGrlhk82IOkwFYxU9zc4jT3jI0kxMGIwx4O+ 0ugTUWe2r/82VZnFVx8NgLaSQYUp4bjzuVs94jcxN3vBKvX0Vvq1vq/O9RWzC2Ga nFBM4zZXpE4rjK8T/PJO/xL7xPvItAUpVCWQrebJoHbEeETwSsfHydKjzPqCPl16 JpAkA9mRWtvXlyQbujp8WyLUxrYjofRcLIGruZIhUS+Q2j851XlXPZcr3+piYind T1U8t+lCM/rb8WoChP4FyGncndLa8mEmNr8rpwfe43FkEdXnPoxH6lR0bWrQ1EIN gCHIG41puYGOz0HzckwP6g+GhmnDL72HwX/KYbWzzvLR+dQQeerCODuUMBepId5K lz4My0E35qnEgqfoDl2YNS3zYMQWoI5uo3nhwGbrHz56NldvNwpiJMsJ913ukqPT iCe7FRF1WQhpMeyZM7VlrrGh5NQtDEW9jiOnTzMvNZq3ItHXvE+U//mTabjROO6u ZC+UVe2l4Ea3z0G6FoIiEP5UQA2ORCPdARDtXlBsDcXauMf00+E= =5rH3 -----END PGP SIGNATURE----- --z2e7mqe5e3kn4cny--