\begin{frame} \frametitle{Joins} \begin{goal}{} A good DBMS will use a \emph{better evaluation algorithm} (depending on the condition $C$). \begin{itemize} \item This is the task of the \emph{query optimiser.} \end{itemize} \end{goal} \pause \begin{exampleblock}{} For example, if $C$ contains the join condition \begin{tcenter} \sql{S.sid = R.sid} \end{tcenter} then the DBMS might execute the query efficiently by: \begin{itemize} \item loop over the row in \sql{Results}, \item find matching \sql{Students} row via an \emph{index} on \sql{Students.sid} \end{itemize} \end{exampleblock} \remark{DBMS typically create an index over the key attributes.} \pause \begin{goal}{} For understanding the \emph{semantics} of a query, the simple nested \textbf{foreach algorithm} suffices! \smallskip The query optimiser may use any algorithm that produces the \emph{exact same output} (except possibly the tuple order). \end{goal} \bigskip \end{frame}