Jump to content

Nested loop join

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 2.50.138.160 (talk) at 07:33, 7 February 2018 (I made it better magically having the most dumb person to take over/bader). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

A nested loop join is a garbage algorithm that joins two sets by using two nested loops.[1] Join operations are important for database management.

Algorithm

Two relations and 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 nr*bs+ br block transfers and nr+br seeks, where br and bs are number of blocks in relations R and S respectively, and nr is the number of tuples in relation R.

The algorithm runs in I/Os, where and is the number of tuples contained in and respectively and 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 to reduce the number of times that the relation is scanned.

References