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.94.2) (envelope-from ) id 1u1h8S-006Z1a-VX for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Apr 2025 07:43:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u1h8R-00DAa4-DE for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Apr 2025 07:43:11 +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.94.2) (envelope-from ) id 1u0jGP-001c7j-Ek; Fri, 04 Apr 2025 15:47:25 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u0jGN-002wPu-2d; Fri, 04 Apr 2025 15:47:24 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5e66407963fso4187901a12.2; Fri, 04 Apr 2025 08:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743781642; x=1744386442; 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=w+gcWpcXmx9MvycyQt+lpFXfWbxnFNw8WmF9RL+kG8Y=; b=Crnx0de59/yhdynR9xKIgBJDKE2tQ90vTp/rdhSTfLsy6/M1F9RWqecKU9h/2MbRia qD3DB/fY58evYevX0iz8Yz3sbBDlfR1bqRQNHCKX9xMZy8brHOsRm4Sfnni2STnUiPFS AlJwwzGZVW1wiTo6GV8Sd/EfS3vXsR7Fi1aBZtZBeVWrtXB3nye6hmYL6uPBWVccxAlm 5TJ/VFwY/f1E3iZAGnHqRj2vNLnPJfw8vE8EJSE+ZDqgwvBFT0zFO6lU6SEovjbTNn57 5ErHTeIYZ+KCOHb1o4SChUzUQM2QVat3vfAJWXoaYGOeC1IyuJ7y78s/ySKxUZu6SMcy AgcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743781642; x=1744386442; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=w+gcWpcXmx9MvycyQt+lpFXfWbxnFNw8WmF9RL+kG8Y=; b=Uzjd1cK/WPhCJLWDtMDRMizJ1tlT7WjH6pt23SykSlpnLkeGtjG3iSzvJUHwYydO3e utAfOInagCdJzePF21Xu6XoRQpBJ/TXCWB/trvM0xetglG2Dg98XEVdNByCtFWVDODYA Pj9UIhbrDcttTEnIltX/NZjHTzwvMi19zyWIRzl9OvRNM4poFAPSXflNP6sPnqMElU9d rK4DciYejU8EAIWDBnqEKWPVCu3+q/CCDMGnDncyrWlTc9e2G89y6d1bD9Z1EPjof524 Yfai/t9wYEMAkFxzCpx+ePVABOL7LUnv1Yw99CIEegTX+zKKY2kOJBE8NdqPd+/03gLv lXKg== X-Forwarded-Encrypted: i=1; AJvYcCUo5ki7JBS/QTgOO1T0UCZPu2Dg/SBP2OJlHmZ/vF4ua7rwri1kif/MYd5vwyYv6v9ToIW3WEOOhBI544Kg@lists.postgresql.org X-Gm-Message-State: AOJu0YyqrBVMbI6oEKzU8xGHDoi6u1WFeuCbx/QMASYqI3psxwnKuvuU agokO+24bh1GjXUDnYU/OMSWzSBHW114HZocXhSIN7u8Ncoh1w/Ft90yxkn3TpQeoG6k9cNUu+b toWHEBr987XbSV6MpaA5y5mIhqlA7Npxj X-Gm-Gg: ASbGncsbDSuyCgbiLiqsUXlUt2Rqe79xbtFNtBHzdBncPH843fcZviAOpV5g+cQpTj+ /NfEfkOaeumEpuaXllq8fp1UTo+R0CoGGdVtdkUcDmoDRQbmGQMeTJuWHtIIhsmJSryllhJrPUQ ZGlNpZ5d/T8uihWvIPxo5IuXYxjCkhfhwTLC+ZKRg+sNbGPK8uSQMeXycJ3OqE X-Google-Smtp-Source: AGHT+IHCz9xUlD6tk93id1TaHqhqZDByfM73FfKdB1ZtzYZ1Ub88xy8eZ4LZ/0VbkJmnNCslmL8VSvLVCGK14dhylvw= X-Received: by 2002:a05:6402:35d6:b0:5ed:3228:cfee with SMTP id 4fb4d7f45d1cf-5f0b5c3e38emr2952310a12.0.1743781641870; Fri, 04 Apr 2025 08:47:21 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Melanie Plageman Date: Fri, 4 Apr 2025 11:47:10 -0400 X-Gm-Features: ATxdqUGLfptALJ3vIKAlXAJ1Icp8S6Chn3xUAyK9IEdu5-gJ8_x-5tyLuGnlO8E Message-ID: Subject: Re: pgsql: Convert 'x IN (VALUES ...)' to 'x = ANY ...' then appropriate To: Alexander Korotkov Cc: pgsql-committers@lists.postgresql.org, PostgreSQL Hackers 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 Fri, Apr 4, 2025 at 9:17=E2=80=AFAM Alexander Korotkov wrote: > > Convert 'x IN (VALUES ...)' to 'x =3D ANY ...' then appropriate > > This commit implements the automatic conversion of 'x IN (VALUES ...)' in= to > ScalarArrayOpExpr. That simplifies the query tree, eliminating the appea= rance > of an unnecessary join. I haven't looked at this patch, but it seems likely that it is related to the recent failures I noticed in CI in the subselect test when the regress suite is run by 002_pg_upgrade.pl diff --strip-trailing-cr -U3 C:/cirrus/src/test/regress/expected/subselect.out C:/cirrus/build/testrun/pg_upgrade/002_pg_upgrade/data/results/subselect.ou= t --- C:/cirrus/src/test/regress/expected/subselect.out 2025-04-04 14:44:17.637206600 +0000 +++ C:/cirrus/build/testrun/pg_upgrade/002_pg_upgrade/data/results/subselec= t.out 2025-04-04 14:47:20.358393500 +0000 @@ -2769,15 +2769,16 @@ EXPLAIN (COSTS OFF) SELECT c.oid,c.relname FROM pg_class c JOIN pg_am a USING (oid) WHERE c.oid IN (VALUES (1), (2)); - QUERY PLAN ---------------------------------------------------------------- - Hash Join - Hash Cond: (a.oid =3D c.oid) - -> Seq Scan on pg_am a - -> Hash - -> Index Scan using pg_class_oid_index on pg_class c - Index Cond: (oid =3D ANY ('{1,2}'::oid[])) -(6 rows) + QUERY PLAN +--------------------------------------------------------- + Merge Join + Merge Cond: (c.oid =3D a.oid) + -> Index Scan using pg_class_oid_index on pg_class c + Index Cond: (oid =3D ANY ('{1,2}'::oid[])) + -> Sort + Sort Key: a.oid + -> Seq Scan on pg_am a +(7 rows)