[DMDB] Fix issues, improve query processing with notes on time complexities

This commit is contained in:
2026-07-27 14:41:27 +02:00
parent d197d01f24
commit be2e079959
22 changed files with 142 additions and 34 deletions
@@ -1,10 +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$.
Sorting can be optimized using replacement sort, the output is \cost{$\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 \}$
The cost drops to \cost{$3 \cdot (P_R + P_S)$ I/Os}, but we need memory such that $B^2 \geq \max\{ P_R, P_S \}$