Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w34zk-000sSS-0A for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 04:28:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w34zi-00GGgN-2E for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 04:28:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w34zi-00GGgF-1I for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 04:28:26 +0000 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w34zf-00000000Tak-0Wtt for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 04:28:25 +0000 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43b40003d13so294925f8f.2 for ; Wed, 18 Mar 2026 21:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773894503; cv=none; d=google.com; s=arc-20240605; b=GeM5Y8jp45PWAOUueH2bBXb0HPDU60MAFW3o/tioUM+zSbx8SoryeVM0IulYmYuQOD pBnECXyCOVneaE5yrYEvmzwuMGf7a5U9kVJbM5elmYeuRVeqF2tGkCqNDl93XBUfit/R tIqxbgLLlHEXapqlsr8Ug1lWWA8O7pP5AVB5FD1gpNQUSlgri5r6XnkhNPDsvAQ+q1tJ q5Qfkqc0y60sNkGHzAXqITMhdUe1OLJpuMelkbj9ll31OvN5XT8Y1CbRX98N5woIq+6g Jt9CQI+FCYBJMmiUOgOf8SA3vFsud0JXsZTQzoJblbtT+g28gxBk+b+HprNU1dkP+KlK 0O9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9y2mZGZiwcsDw9zLim/w6NscQ5z/weFBW4EOGWQsGfs=; fh=6e0rqbOeHKgM6FgpJqhHkJx2dbi4r1l+pqtr/uWtwu0=; b=N2hk+7/UKGpID7M36okoewuJYIk4Gr3MuDpQoWsed4MulqmGp6secmmam7BPuqmHhs j7AEN0j68fDaFJ9vMRVwZZEVO+rNcwVJ1IoIriKc0tezQ6nfyqA42dO4N8E8mW4gq54A RSDlwlafBDmcMUp4cp3zdHRn2DhQbAJ0hUBM1d6Fv6YXo8y2q3A9JHdriKWBoFZQTTSI ewFA0TGJbgzQnOFN2BjCuO3OVDTgCME+Ooubycga0nMrBDmjCkHV0gus7NMQlkqNMSfV e53Wqiuh/lUqvuQRRLWC5VAyxa70o0Q98//vF5CSUZj2j3dl5NMNZj/fdEkuG/wGE00X 5q/w==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773894503; x=1774499303; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=9y2mZGZiwcsDw9zLim/w6NscQ5z/weFBW4EOGWQsGfs=; b=NM1lzwQfsxfaXiafgG/KBwtuDsRpdLwDjD5gRx3i854ztQ2MAUSmDhLvkhSKUZYHoI raMq0dV+4oOxWDivaNHbqXcx1nSY6l2NTJeREcafeJ5q8FfmZ91z8a+jWHWiqHmXaDk2 NRHADHWadY9M6LwLlAnq8UfFfR6DJi9asa/zc0kOT4nEwessSddivD0YJCNEVuJY28Em UZZ9NkwXa8vg09FyumhyHdiPbdrT+rGzsu7KHfu9oGcDmL11pJiVyrLxRXN9oalazbLZ 5DS2LrXwwUtAwg9+VTIhC0dmisNsTeyV2XWdcu9U8SQWAIOl5g3yz8gcrqur8JzTcmwh DOSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773894503; x=1774499303; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9y2mZGZiwcsDw9zLim/w6NscQ5z/weFBW4EOGWQsGfs=; b=CBmR5QovZm0V4F1AfBQUc8ERsnoZG31LC1WGQP5eWsMo+PsQ6N3D+fUXkqyH9+1ETw 0oS0L4sQB/3v3qz5WSBQhyErv53uO8CxKDocH7liV3JCVYsq47X5Ua2/z4lBUohD3zNT cLN0a5SHen2ufTKSbl+J15bWSAjRA2CrlTJhImvewgx5NZpWQcdO66oxZ53XdH2uVHwD y4XRHhI/FoTnxfK6az3qCX095NrLgPPB1v4PT3TxLyGbpJwUb8CsAP8ZFL93JZ6XXH1h 9lHyeYPB4YorW4z8AIo2SJCJa98Cg2fMkgxQESQvM79rzqDpy4P0wcYrcaRUFPOMJSCg JNKw== X-Forwarded-Encrypted: i=1; AJvYcCXsk8SK4vHQ1F4rjk58LmSd9ugIe14Ms0aLqkx7TGrjE7d7bd6bM+e0oxfpieEI6K/zcgmoxtHoVfZI24Er@lists.postgresql.org X-Gm-Message-State: AOJu0YwoSIavgnLaZZY1k+iHp5SN3wl3to7cGM+VGBwQg53i3QplWXZA djSi8XFXm9pkkNPlgBeg4P41CMwMwOSyMVpMQN43S67LSkt4yey3qIiCAdhhK2k1tD7Tl7QMcAu Qgxu40ZsEx1cwyHc+pl5/Ofuej7GqwSc= X-Gm-Gg: ATEYQzyGSNXD8ST+xfUbvJ69xw3+cce3Ed06NCxcM0/idbnXQZ7XGam+gHkgmh9JAu7 /rkAGiasQUQ3yrI0nkf+ikMKyO7ZVWSF3ANwePsuajvRcVHPfROYwcOv58BwXdNBaxf5B+Cvo24 VZwGTnuIJTDBK+66RkF19tjRsjAIypwHNZnLjEk+z4UsHMD7fGGtxbYqZFKP8w2VymwFKojBUdN picJGMNHurGiJ6gecbqDG5/4p0syX2omSn7mBh/xgVtDZynI4xC9DWp4QoAdKchcBVCnRmjDbCZ 0JbQD4WhQvkl5GMfX8GQRINZibX7Gr3500QAvMf2yLFAZSfe1lW9SS5Grfqfm/4U21mR3iBvqQ= = X-Received: by 2002:a05:6000:4381:b0:439:bcdb:95af with SMTP id ffacd0b85a97d-43b5264b039mr10651161f8f.0.1773894503055; Wed, 18 Mar 2026 21:28:23 -0700 (PDT) MIME-Version: 1.0 References: <52596e08-0902-475b-ad0f-265ec6918f19@gmail.com> <7791ec74-369d-48c7-969c-cf4ad18024f2@tantorlabs.com> <6b3aebb5-f26c-4f50-abd6-e733d452af26@gmail.com> <52f3c637-465d-4f0e-9546-732ecf61ab87@tantorlabs.com> <3fc74079-f429-48c8-ad8c-688b21d4d1c1@gmail.com> <4c761b02-5a60-4076-aa0c-9c6fef06e2c1@tantorlabs.com> <2bdf4a7e-f5b9-4e75-b5a3-1e2608fd3297@tantorlabs.com> <390a46f3-dbc4-4dc1-b49d-5cc61dd36026@tantorlabs.com> <977365f2-2ab7-4008-8d9c-f62ef5271cea@tantorlabs.com> <83464ae9-a79a-43c8-a425-4b0773f9e759@tantorlabs.com> In-Reply-To: <83464ae9-a79a-43c8-a425-4b0773f9e759@tantorlabs.com> From: David Rowley Date: Thu, 19 Mar 2026 17:28:11 +1300 X-Gm-Features: AaiRm53dixUp6MQsMppR6mo6N_baRBzXfnXTCtUWQVvv4flIcz52cGIyHZyHG-A Message-ID: Subject: Re: Reduce planning time for large NOT IN lists containing NULL To: Ilia Evdokimov Cc: Zsolt Parragi , David Geier , PostgreSQL Developers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 19 Mar 2026 at 03:26, Ilia Evdokimov wrote: > After the new test was committed, I realized that v8 tests relies on sele= ctivity calculation, which are not guaranteed to remain stable over time an= d way vary depending on planner heuristics or platform differences. Therefo= re, it seems better to remove tests from v8. > > Instead, we can test the invariant behavior: when NULL is present in a <>= ALL clause, the selectivity is always 0.0. > > The v9-patch adds three test cases: a degenerate case with only NULL, NUL= L combined with constants, NULL combined with both constants and non-consta= nt expression. > > Thoughts? I've now pushed the main patch. I did end up removing the first test of the v9 tests since it was exercising the same code path as the 2nd test. I also didn't see the need to execute the query, so I changed it to run EXPLAIN without ANALYZE. For the main patch, I only adjusted the comments a little. I wanted to make reference to var_eq_const() as the short-circuit really is trying to follow what that function would have done if the short-circuit path hadn't been taken. I also added comments in the tests to explain what we are expecting to see. I am probably in a minority of people who do this. I find it's important to understand that when it comes to updating the expected results of existing tests. I expect we have plenty of tests that no longer test what the original test was meant to test as a result of people not doing this. David