The optimum join order - revisited
The best join ordering
problem:
Although there is an
exact algorithm
(based on dynamic programming)
available, the
algorithm running time can
be quick high
(not polynomial))
In this webpage, we study
a linear time
heuristic to find the
best join ordering
A heuristic for finding
the best join ordering of
N relations:
A heuristic for finding
the best join ordering of
N relations:
Example of applying the best join order heuristic
(Click in figure to
pull out
the relation statistics)
Example of applying the best join order heuristic
- Iteration 1
Example of applying the best join order heuristic
- Iteration 1
R, S:
R, T:
Example of applying the best join order heuristic
- Iteration 1
R, U:
S, T:
Example of applying the best join order heuristic
- Iteration 1
S, U:
T, U:
Example of applying the best join order heuristic
- Iteration 1
Therefore:
Example of applying the best join order heuristic
- Iteration 1
Therefore:
Let's pick: T ⋈ U...
Example of applying the best join order heuristic
- Iteration 2
S1 =
T ⋈ U (from last result !)
Example of applying the best join order heuristic
- Iteration 2
T ⋈ U and
R:
Example of applying the best join order heuristic
- Iteration 2
T ⋈ U and
S:
Example of applying the best join order heuristic
- Iteration 2
Therefore:
Example of applying the best join order heuristic
- Iteration 3
S2 =
(T ⋈ U) ⋈ S
(from last result !)
Example of applying the best join order heuristic
- Iteration 3
(T ⋈ U) ⋈ S and
R:
Final remark
❮
❯