Details
-
Task
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
-
None
-
10.3.6-1, 10.4.0-1
Description
Consider two tables defined as
create table t1 (a int primary key, b int, check b < 5);
|
create table t2 (a int primary key);
|
and a query
select * from t1, t2 where t1.b=t2.a and t2.a > 2;
|
If to take into account the check constraint on t1.b then the query will be looking as
select * from t1, t2 where t1.b=t2.a and t2.a > 2 and t1.b < 5;
|
As t1.b is equal to t2.a a much better condition on the column t2.a can be deduced:
t2.a > 2 and t2.a < 5
Consider another query
select * from t1, t2 where t1.a=t2.b and t2.a > 10;
|
As in the previous one, a new condition for t2.a can be deduced: t2.a > 10 and t2.a < 5
This condition is always false, so there is no need to evaluate the query.