opt: contradictions from check constraints should be used for optimization #63112
Labels
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
T-sql-queries
SQL Queries Team
Projects
Currently, CHECK constraints are not being take into consideration for optimization, for example:
create table users (age int, check (age > 0 and age < 150));
And then try to select with a value that is not possible, such as
select * from users where age=200
Checking with the explain option, we can see that is doing a
FULL SCAN
, even though we won't find any values.If the constraint is validated, it should be able to detect the contradiction and convert that scan to a zero values node.
Jira issue: CRDB-6430
The text was updated successfully, but these errors were encountered: