Translating SQL Queries into Relational Algebra
Conjunctive Normal Form
Why?
Initial plan:
SelectScan(
TableScan(Employee),
not (salary < 20000 or salary > 200000)
CNF:
SelectScan(
TableScan(Employee),
salary >= 20000 and salary <= 200000)
The predicate is now in a form to use an index on salary:
SelectIndex(
emp_salary_idx,
GE, [20000],
LE, [20000])
|