Update all new Tasks

This commit is contained in:
Ingy döt Net 2015-02-20 09:02:09 -05:00
parent 00a190b0a6
commit 91df62d461
5697 changed files with 93386 additions and 804 deletions

View file

@ -0,0 +1,38 @@
The classic [[wp:Hash Join|hash join]] algorithm for an inner join of two relations has the following steps:
<ul>
<li>Hash phase: Create a hash table for one of the two relations by applying a hash
function to the join attribute of each row. Ideally we should create a hash table for the
smaller relation, thus optimizing for creation time and memory size of the hash table.</li>
<li>Join phase: Scan the larger relation and find the relevant rows by looking in the
hash table created before.</li>
</ul>
The algorithm is as follows:
'''for each''' tuple ''s'' '''in''' ''S'' '''do'''
'''let''' ''h'' = hash on join attributes ''s''(b)
'''place''' ''s'' '''in''' hash table ''S<sub>h</sub>'' '''in''' bucket '''keyed by''' hash value ''h''
'''for each''' tuple ''r'' '''in''' ''R'' '''do'''
'''let''' ''h'' = hash on join attributes ''r''(a)
'''if''' ''h'' indicates a nonempty bucket (''B'') of hash table ''S<sub>h</sub>''
'''if''' ''h'' matches any ''s'' in ''B''
'''concatenate''' ''r'' and ''s''
'''place''' relation in ''Q''
'''Task:''' implement the Hash Join algorithm and show the result of joining two tables with it.
You should use your implementation to show the joining of these tables:
<table><tr><td><table border>
<tr><th>Age</th><th>Name</th></tr>
<tr><td>27</td><td>Jonah</td></tr>
<tr><td>18</td><td>Alan</td></tr>
<tr><td>28</td><td>Glory</td></tr>
<tr><td>18</td><td>Popeye</td></tr>
<tr><td>28</td><td>Alan</td></tr>
</table></td><td><table border>
<tr><th>Name</th><th>Nemesis</th></tr>
<tr><td>Jonah</td><td>Whales</td></tr>
<tr><td>Jonah</td><td>Spiders</td></tr>
<tr><td>Alan</td><td>Ghosts</td></tr>
<tr><td>Alan</td><td>Zombies</td></tr>
<tr><td>Glory</td><td>Buffy</td></tr>
</table></td></tr></table>