Block nested loop
Template:Linkless 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.