mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-07-27 21:29:09 +02:00
18 lines
758 B
TeX
18 lines
758 B
TeX
\subsubsection{Nested Loops Join (NLJ)}
|
|
\begin{algorithm}
|
|
\caption{Nested Loops Join Algorithm}
|
|
\begin{algorithmic}[1]
|
|
\Procedure{NestedLoopsJoin}{$R$, $S$}
|
|
\For{each page $p_R \in R$}
|
|
\For{each page $p_S \in S$}
|
|
\State Join the tuples on page $p_R$ with the tuples on page $p_S$ (evaluate the predicate for all pairs)
|
|
\State Add matching tuples to the join output
|
|
\EndFor
|
|
\EndFor
|
|
\EndProcedure
|
|
\end{algorithmic}
|
|
\end{algorithm}
|
|
|
|
The cost here is \cost{$P_R + P_R \cdot P_S$ I/Os}, where $P_X$ is the number of pages in the relation $X$.
|
|
Furthermore, the DBMS should put the smaller relation on the outer loop to improve performance.
|