Jump to content

Block nested loop

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by SmackBot (talk | contribs) at 22:01, 3 January 2007 (Date/fix the maintenance tags using AWB). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

An algorithm used to join two relations in a relational database. A variation on the simple nested loop join used to join two relations and . Suppose . Instead of reading the two relations tuple by tuple as done by the simple nested loop join, block nested loop reads the relation in blocks filling all available internal memory except 2 pages. For each block of an iteration through is performed read one page at a time, for each page read from the tuple the page is compared with the tuples in the block of , every pair of tuples that satisfy the join condition is added to the output page.

The block nested loop runs in I/Os where is the number of available pages of internal memory and and is size of and respectively in pages. Note that block nested loop runs in I/Os if fits in the available internal memory.