Logical Query Plan

In Relational Databases, Logical Query Plan - intermediate code in the Query Processing pipeline (typically a Relational Algebra expression)

  • Essentially it's an execution tree
  • We evaluate it bottom-up
  • Usually need to optimize it before executing to make the execution faster


Example

Suppose we have a Relational Algebra expression:

  • $\pi_{A, B} \big(\sigma_{A = 5}(R) \cup (S \Join T) \big)$
  • this defines the following execution tree
logical-query-plan-ex.png


Physical Query Plan

A Physical Query Plan is the same as Logical Query Plan, but with specific algorithms assigned to each operation (node of the tree)


Questions to consider

Example

We just assign some operation to each node:

plan-selection-bad.png


Sources