Hash join: Difference between revisions

Content added Content deleted
(clean up verbiage a bit)
Line 2: Line 2:
The classic [[wp:Hash Join|hash join]] algorithm for an inner join of two relations has the following steps:
The classic [[wp:Hash Join|hash join]] algorithm for an inner join of two relations has the following steps:
<ul>
<ul>
<li>Hash phase : Creating a hash table for one of the two relations by applying a hash
<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
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>
smaller relation, thus optimizing for creation time and memory size of the hash table.</li>
<li>Join phase : Scanning the larger relation and finding the relevant rows by looking in the
<li>Join phase: Scan the larger relation and find the relevant rows by looking in the
hash table created before.</li>
hash table created before.</li>
</ul>
</ul>
Line 21: Line 21:
'''place''' relation in ''Q''
'''place''' relation in ''Q''


Implement the Hash Join algorithm in your programming language (optionally providing a test case as well).
Task: implement the Hash Join algorithm and show the result of joining two tables with it.


=={{header|Haskell}}==
=={{header|Haskell}}==