|
| 1 | +\documentclass[../../main.tex]{subfiles} |
| 2 | + |
| 3 | +\begin{document} |
| 4 | + |
| 5 | +\subsection{15.7 Buffer Management} |
| 6 | + |
| 7 | +\subsubsection*{Exercise 7.1} |
| 8 | + |
| 9 | +a) |
| 10 | + |
| 11 | +The terms $B(R)$ and $B(S)$ represents binary relations between the relations |
| 12 | +$R$ and $S$. In one-pass, there is an approximate requirement for the binary |
| 13 | +operation between the relations $R$ and $S$ as: |
| 14 | + |
| 15 | +$$ |
| 16 | +\min(B(R), B(S)) \leq M |
| 17 | +$$ |
| 18 | + |
| 19 | +This approximation means that the one buffer is used to read the blocks |
| 20 | +of larger relation and for smaller relations, it requires $M$ buffers |
| 21 | +additionally with the main memory structure. According to the one-pass |
| 22 | +algorithm and given terms, the relation either $R$ or $S$ must fit into the |
| 23 | +memory. So, the approximation rule would be: |
| 24 | + |
| 25 | +$$ |
| 26 | +min(B(R), B(S)) \geq \frac{M}{2} |
| 27 | +$$ |
| 28 | + |
| 29 | + |
| 30 | +b) |
| 31 | + |
| 32 | +This algorithm might work properly only if the one-pass union, |
| 33 | +intersection and difference between the relations $R_{i}$ and $S_{i}$ |
| 34 | +whose sizes are found to be $\frac{B(R)}{M - 1}$ and $\frac{B(S)}{M - 1}$ |
| 35 | +respectively as it is known, the one-pass algorithm requires |
| 36 | +operand and it occupies at most $M - 1$ blocks. |
| 37 | + |
| 38 | +Therefore the two-pass hash based algorithms requires at least |
| 39 | +$\min(B(R), B(S)) \leq M^{2}$ approximately. |
| 40 | + |
| 41 | +Since the worst case of two-pass algorithm contains $\frac{M}{2}$ |
| 42 | +blocks. The memory between $M$ and $\frac{M}{2}$ requires approximately |
| 43 | + |
| 44 | +$$ |
| 45 | +\min(B(R), B(S)) \leq \frac{M^2}{4} |
| 46 | +$$ |
| 47 | + |
| 48 | +c) |
| 49 | + |
| 50 | +$$ |
| 51 | +\max(B(R), B(S)) \leq \frac{M^2}{4} |
| 52 | +$$ |
| 53 | + |
| 54 | +\subsubsection*{Exercise 7.2} |
| 55 | + |
| 56 | +a) |
| 57 | + |
| 58 | +Following the concept of FIFO the new blocks occupies the buffer by |
| 59 | +emptying the current longest block in buffer. When doing the nested loop |
| 60 | +join operation, the FIFO pointer pointing the longest block of the buffer |
| 61 | +and it need not points out the first tuple in the buffer. |
| 62 | + |
| 63 | +So it will not improve the number of disk I/O's on nested loop |
| 64 | +join operations. |
| 65 | + |
| 66 | +b) |
| 67 | + |
| 68 | +The clock algorithm contains the handle which places the disk on the |
| 69 | +available buffer by rotating the handle in clockwise direction. While doing |
| 70 | +the nested loop join, approach also doesn't searches for the first tuple as |
| 71 | +the handle of the clock is present on the available space of the buffer. |
| 72 | + |
| 73 | +It will not improve the number of disk I/O's on nested loop join |
| 74 | +operations. |
| 75 | + |
| 76 | +\subsubsection*{Exercise 7.3} |
| 77 | + |
| 78 | +Need community help. |
| 79 | + |
| 80 | +\end{document} |
| 81 | + |
0 commit comments