Skip to content

Commit dff61fe

Browse files
committed
Finish chapter 15
1 parent 334a920 commit dff61fe

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

src/chapter_15/ch15.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ \section{Chapter 15 Query Execution}
1010
\subfile{./sec4.tex}
1111
\subfile{./sec5.tex}
1212
\subfile{./sec6.tex}
13+
\subfile{./sec7.tex}
1314

1415
\end{document}

src/chapter_15/sec7.tex

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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

Comments
 (0)