mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-07-27 21:29:09 +02:00
19 lines
719 B
TeX
19 lines
719 B
TeX
\subsubsection{Simple Join}
|
|
\begin{algorithm}
|
|
\caption{SimpleJoin Algorithm}
|
|
\begin{algorithmic}[1]
|
|
\Procedure{SimpleJoin}{$R$, $S$}
|
|
\For{each tuple $t_R \in R$}
|
|
\For{each tuple $t_S \in S$}
|
|
\If{$\texttt{pred}(t_R, t_S)$}
|
|
\State $\texttt{add}\{ t_R, t_S \}$ to the join output
|
|
\EndIf
|
|
\EndFor
|
|
\EndFor
|
|
\EndProcedure
|
|
\end{algorithmic}
|
|
\end{algorithm}
|
|
Here, the max output size is $T_R \cdot T_S$, where $T_X$ is the number of tuples for relation $X$.
|
|
|
|
The cost is obviously \cost{$\texttt{cnt}(R) \cdot \texttt{cnt}(S)$}, with $\texttt{cnt}(X)$ the number of tuples in $X$.
|