Robert Haas <robertmh...@gmail.com> writes: > On Mon, Nov 25, 2024 at 4:39 PM Tom Lane <t...@sss.pgh.pa.us> wrote: >> ... I think Robert >> must have had constraint_exclusion = 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=# create table foo (a int); CREATE TABLE regression=# explain select * from foo where a < 1 and a > 1; QUERY PLAN ----------------------------------------------------- Seq Scan on foo (cost=0.00..48.25 rows=13 width=4) Filter: ((a < 1) AND (a > 1)) (2 rows) regression=# show constraint_exclusion; constraint_exclusion ---------------------- partition (1 row) regression=# set constraint_exclusion = on; SET regression=# explain select * from foo where a < 1 and a > 1; QUERY PLAN ------------------------------------------ Result (cost=0.00..0.00 rows=0 width=0) 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%3D7EahSyzEj5yrqYKMQ0QOL9Q%40mail.gmail.com