182/257
\begin{frame}
  \frametitle{Detecting Conflicts}
  
  Now suppose an updating query comes in:
  \smallskip
  
  \begin{code}{\textwidth}{$Q_3$: update request}
    \sql{UPDATE CUSTOMERS}\\
    \sql{SET   NAME = 'Pete'}\\
    \sql{WHERE CUSTKEY = 17}
  \end{code}
  \vspace{-1ex}
  \pause
  
  \begin{exampleblock}{}
  The query $Q_3$ will try to:
  \begin{itemize}
    \item obtain an \emph{IX lock} on the \emph{database}
    \item obtain an \emph{IX lock} on the \emph{table} \sql{CUSTOMERS}
  \end{itemize}
  Afterwards obtain an \emph{X lock} on the \emph{row} with \sql{CUSTKEY = 17}.
  \end{exampleblock}
  
  \begin{itemize}
  \pause
    \item compatible with $Q_1$ \\(no conflict between IS of $Q_1$ and IX lock of $Q_3$ on table)
  \pause
    \item \alert{incompatible} with $Q_2$\\ (\alert{conflict} between S lock of $Q_2$ and IX lock of $Q_3$ on table)
  \end{itemize}
\end{frame}