\begin{frame}
\frametitle{Optimising Performance}
Suppose you have a typical log of queries for your database.
\medskip
\pause
For each query in the log:
\begin{itemize}
\item Analyse average time and variance for this type of query.
\begin{itemize}
\item Long delays or frequent aborts may indicate contention.
\end{itemize}
\item Is it is a read-only or updating query?
\begin{itemize}
\item Compute the read-sets and write-sets.
\item Will it require row or table locks? Shared or exclusive?
\end{itemize}
\end{itemize}
\medskip
How do read- and write-sets of the different queries intersect?
\begin{itemize}
\item What is the chance of conflicts? (delays/rollbacks)
\end{itemize}
\medskip
\pause
\begin{goal}{}
Once you understand your query workload, you might improve performance by:
\begin{itemize}
\item Rewriting queries to have smaller read- and write-sets.
\item Change scheduling of queries to reduce contention.\\
\remark{E.g. rewrite applications to do large aggregation queries at night.}
\item Use a different isolation level for the queries.
\end{itemize}
\end{goal}
\end{frame}