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 1tFz8Y-000F4q-DX for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Nov 2024 17:14:06 +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 1tFz8X-008OuQ-0M for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Nov 2024 17:14:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tFz8W-008OuI-MA for pgsql-hackers@lists.postgresql.org; Tue, 26 Nov 2024 17:14:04 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tFz8T-004Ajj-Me for pgsql-hackers@lists.postgresql.org; Tue, 26 Nov 2024 17:14:04 +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 4AQHDtx71686218; Tue, 26 Nov 2024 12:13:55 -0500 From: Tom Lane To: Robert Haas cc: Peter Geoghegan , ro b , pgsql-hackers Subject: Re: Self contradictory examining on rel's baserestrictinfo In-reply-to: References: <1458911.1732570753@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Tue, 26 Nov 2024 11:55:29 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1686216.1732641235.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 26 Nov 2024 12:13:55 -0500 Message-ID: <1686217.1732641235@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Mon, Nov 25, 2024 at 4:39=E2=80=AFPM Tom Lane wro= te: >> ... I think Robert >> must have had constraint_exclusion =3D on for his examples a >> couple messages back.) > I definitely didn't change the value of that setting. It's possible I > was running on an older branch, but I don't think it was anything > ancient. Hmm, constraint_exclusion has defaulted to "partition" for many years now. But when I tried to reproduce your examples at [1]: regression=3D# create table foo (a int); CREATE TABLE regression=3D# explain select * from foo where a < 1 and a > 1; QUERY PLAN = ----------------------------------------------------- Seq Scan on foo (cost=3D0.00..48.25 rows=3D13 width=3D4) Filter: ((a < 1) AND (a > 1)) (2 rows) regression=3D# show constraint_exclusion; constraint_exclusion = ---------------------- partition (1 row) regression=3D# set constraint_exclusion =3D on; SET regression=3D# explain select * from foo where a < 1 and a > 1; QUERY PLAN = ------------------------------------------ Result (cost=3D0.00..0.00 rows=3D0 width=3D0) One-Time Filter: false (2 rows) and similarly for some of the other examples (I didn't try every one). Maybe your test table was partitioned?? regards, tom lane [1] https://www.postgresql.org/message-id/CA%2BTgmoZqiCwHbZczXXLjucfuHi%3D= 7EahSyzEj5yrqYKMQ0QOL9Q%40mail.gmail.com