|
|
| Line 1: |
Line 1: |
| {{Unreferenced|date=January 2010}}
| | Hello friend. Allow me introduce myself. I am Ron but I don't like when people use my full title. Managing people is what I do in my working day occupation. Some time ago I selected to live in Arizona but I require to transfer for my family. Playing crochet is something that I've done for many years.<br><br>My weblog ... extended auto warranty [[http://Blogzaa.com/blogs/post/14073 simply click the up coming article]] |
| {{Expert-subject|mathematics|date=March 2011}}
| |
| A '''nested loop join''' is a naive [[algorithm]] that joins two sets by using two nested [[loop (computing)|loop]]s. Join operations are important to [[database]] management.
| |
| | |
| ==Algorithm==
| |
| Two relations <math>R</math> and <math>S</math> are joined as follows:
| |
| | |
| For each tuple r in R do
| |
| For each tuple s in S do
| |
| If r and s satisfy the join condition
| |
| Then output the tuple <r,s>
| |
| | |
| This algorithm will involve n<sub>r</sub>*b<sub>s</sub>+ b<sub>r</sub> block transfers and n<sub>r</sub>+b<sub>r</sub> seeks, where b<sub>r</sub> and b<sub>s</sub> are number of blocks in relations R and S respectively, and n<sub>r</sub> is the number of tuples in relation R.
| |
| | |
| The algorithm runs in <math>O(|R||S|)</math> I/Os, where <math>|R|</math> and <math>|S|</math> is the number of tuples contained in <math>R</math> and <math>S</math> respectively. Can easily be generalized to join any number of relations.
| |
| | |
| The [[block nested loop]] join algorithm is a generalization of the simple nested loops algorithm that takes advantage of additional [[memory (computing)|memory]] to reduce the number of times that the <math>S</math> relation is scanned.
| |
| | |
| == Improved version ==
| |
| The algorithm can be improved without requesting additional memory blocks to involve only b<sub>r</sub>*b<sub>s</sub>+ b<sub>r</sub> block transfers. For each read block from <math>R</math>, the relation <math>S</math> can be read only once.
| |
| | |
| For each block block_r in R do
| |
| For each tuple s in S do
| |
| For each tuple r in block_r do
| |
| If r and s satisfy the join condition
| |
| Then output the tuple <r,s>
| |
| | |
| Variable block_r is stored in memory, thus it is not needed to read it from disk for each tuple <math>s</math>.
| |
| | |
| {{DEFAULTSORT:Nested Loop Join}}
| |
| [[Category:Join algorithms]]
| |
| | |
| {{compu-sci-stub}}
| |
Hello friend. Allow me introduce myself. I am Ron but I don't like when people use my full title. Managing people is what I do in my working day occupation. Some time ago I selected to live in Arizona but I require to transfer for my family. Playing crochet is something that I've done for many years.
My weblog ... extended auto warranty [simply click the up coming article]