Query Optimization Process
Parse the SQL query into a logical tree:
- identify distinct blocks (corresponding to nested sub-queries or views).
Query rewrite phase:
- apply algebraic transformations to yield a cheaper plan.
- Merge blocks and move predicates between blocks.
Optimize each block: join ordering.
Complete the optimization: select scheduling (pipelining strategy).