diff --git a/semester4/dmdb/data-modelling-databases-summary.pdf b/semester4/dmdb/data-modelling-databases-summary.pdf index 6422dc9..8e4bc34 100644 Binary files a/semester4/dmdb/data-modelling-databases-summary.pdf and b/semester4/dmdb/data-modelling-databases-summary.pdf differ diff --git a/semester4/dmdb/parts/08_quick-overview/01_theory.tex b/semester4/dmdb/parts/08_quick-overview/01_theory.tex index 723d4ca..951923f 100644 --- a/semester4/dmdb/parts/08_quick-overview/01_theory.tex +++ b/semester4/dmdb/parts/08_quick-overview/01_theory.tex @@ -27,6 +27,7 @@ Finally, we remove all redundant FDs. Below a short explanation as to how to check if a given relation is in any of the normal forms. A relation being in a NF further down the list implies it also is in the above, whereas a relation \textit{not} being in a higher up the list NF implies it isn't in the further below. +Note that the former is implied by the definition of each normal form, in that each requires the DB to be in the previous NF, as well as fulfilling the following conditions: \begin{itemize} \item \bi{1NF}: Each attribute cannot contain further tables or arrays (this is very commonly given in the tasks) \item \bi{2NF}: Determine the candidate keys. Then for each non-prime attribute (i.e. attribute not part of any candidate key) determine if it depends on @@ -46,7 +47,7 @@ This means that for determining if a relation is in 3NF or BCNF, we need to be a This algorithm works as follows: \begin{enumerate} \item Compute the minimal cover - \item Create a relation for each FD $\alpha \rightarrow \beta$ by defining it as $\cR_i = \alpha \cup \beta$ + \item Create a relation for each FD $\alpha \rightarrow \beta$ of the minimal cover by defining it as $\cR_i = \alpha \cup \beta$ \item If no relation $\cR_i$ contains a superkey, add a relation based on a superkey (or better a candidate key) \item Finally, remove redundant relations, i.e. ones that share the same superkey by combining them (e.g. with the example from minimal cover, we would end up with relations $(A, B, C, D)$ and $(A, B, C, E)$, combine them $(A, B, C, D, E)$) diff --git a/semester4/dmdb/parts/08_quick-overview/03_qp.tex b/semester4/dmdb/parts/08_quick-overview/03_qp.tex index 096be61..8efd89a 100644 --- a/semester4/dmdb/parts/08_quick-overview/03_qp.tex +++ b/semester4/dmdb/parts/08_quick-overview/03_qp.tex @@ -19,14 +19,14 @@ Given $B$ frames of memory and $N$ records, we have (typically I/Os in pages to \item For a clustered index, $\texttt{cnt}(P_F) = \texttt{cnt}(R') \div (F_L \cdot R_L)$, with $R_L$ the number of records per leaf page and $F_L$ the fill factor. \item For an unclustered index, $\texttt{cnt}(P_F) = \texttt{cnt}(R')$, with $\texttt{cnt}(R') = \texttt{cnt}(R) \cdot S$, with $S$ the selectivity of the predicate. \end{itemize} - \item \bi{Hash Index}: Cost is $1 + \texttt{cnt}(R') \div L_L + \texttt{cnt}(R')$, where the $1$ is to do the lookup, + \item \bi{Hash Index}: Cost is $1 + \texttt{cnt}(R') \div R_L + \texttt{cnt}(R')$, where the $1$ is to do the lookup, $\texttt{cnt}(R') \div R_L$ to fetch the row IDs and $\texttt{cnt}(R')$ to fetch the records (this is an up-to, it is $\texttt{cnt}(R') \div R_F$ as minimum, for clustered index), with $R_L$ the number of records per Leaf and $R_F$ the number of records per file. \end{itemize} \subsubsection{Projection} -Remember that we need the sort-based and bash-based approach to eliminate duplicates. +Remember that we need the sort-based and hash-based approach to eliminate duplicates. \begin{itemize} \item \bi{Partitioning}: $\texttt{Cost}_\texttt{part}(R) = \texttt{cnt}(R) + \texttt{cnt}(R')$ with $\texttt{cnt}(R') = \texttt{cnt}(R) Q$, with $Q$ the fraction of selected attributes divided by total attributes