Jump to content

Nested loop join

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Esbenrune (talk | contribs) at 17:03, 6 November 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

The naive algorithm that joins two relations and by making two nested loops:

  For each tuple in R as r do
     For each tuple in S as s do
        If r and s satisfy the join condition
           Then output the tuple <r,s> 

The algorithm runs in I/Os, where and is the number of tuples contained in and respectively. Can easily be generalized to join any number of relaitons.