[DMDB] Join, set up next sections

This commit is contained in:
2026-07-21 17:26:30 +02:00
parent 4c2405a497
commit 084167cef7
16 changed files with 168 additions and 7 deletions
@@ -0,0 +1,10 @@
\subsubsection{Optimized Sort Merge Join ((O)SMJ)}
In this section, we are exploring how we can optimize sort and merge with extra memory.
Sorting can be optimized using replacement sort, the output is $\frac{P_R + P_S}{2B}$ sorted runs of length $2B$.
That of course means that the logical optimization is to do a $K$-way merge to merge the sorted runs and join the relations at the same time.
If we have $B$ frames, so we can do a $B-1$ way merge, otherwise, we merge runs from each relation separately to reduce the number of runs
until we have less than $B$ sorted runs, then we perform the join.
The cost drops to $3 \cdot (P_R + P_S)$ I/Os, but we need memory such that $B^2 \geq \max\{ P_R, P_S \}$