Constraints elimination during runtime

From: "Weck, Luis" <luis(dot)weck(at)pismo(dot)io>
To: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Constraints elimination during runtime
Date: 2025-04-16 11:16:32
Message-ID: IA3PR10MB81133D5DD8051D7018DECD338DBD2@IA3PR10MB8113.namprd10.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I am not sure if this list is the most appropriate, but I figured I’d share it here…

If a column has a check constraint, such as CHECK (length(value) < 10) or even something like a VARCHAR(10) shouldn’t a query like this become a no-op/false instantly?

create table test_constraint (
value varchar(10) // could be a CHECK constraint also
);

insert into test_constraint values (‘small’);

-- shouldn’t this qual always evaluate to false?
select * from test_constraint where value = ‘way too big to fit anyway’;

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Laurenz Albe 2025-04-16 12:38:10 Re: Constraints elimination during runtime
Previous Message Yura Sokolov 2025-04-15 10:58:55 Re: many sessions wait on LWlock WALWrite suddenly