> For the complete documentation index, see [llms.txt](https://cs186.gitbook.io/project/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cs186.gitbook.io/project/common/misc/nested-loop-join-animations.md).

# Nested Loop Join Animations

**Key**

* Records highlighted in blue belong to a page in the left relation that is loaded into memory.
* Records highlighted in orange belong to a page in the right relation that is loaded into memory.
* The dark blue and dark orange records are the two records currently being compared to see if they fit the join criteria.
* The purple squares represent which pairs of records have already been considered.

Notice that regardless of the nested loop join implementation, by the time we finish we've considered every pair of records!

## Normal Speed

### Simple Nested Loop Join

![](https://678656433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFVQnrLlCBowpNWJo1E%2Fsync%2Fa73c972f30b1f1f9a4d3338fa7994c85c980d74a.gif?generation=1601331281677102\&alt=media)

### Page Nested Loop Join

![](https://678656433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFVQnrLlCBowpNWJo1E%2Fsync%2F6adf3cb0f45370a03122af29a549010ff73d14eb.gif?generation=1601331281376980\&alt=media)

### Block Nested Loop Join (B=4)

![](https://678656433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFVQnrLlCBowpNWJo1E%2Fsync%2Feec406d2f15d541041f6cb5a3578064547de1227.gif?generation=1601083826234812\&alt=media)

## x2 Speed

### Simple Nested Loop Join

![](https://678656433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFVQnrLlCBowpNWJo1E%2Fsync%2F7d98e512c06ac453b6d348f26f034152a05f9ed7.gif?generation=1601331287864478\&alt=media)

### Page Nested Loop Join

![](https://678656433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFVQnrLlCBowpNWJo1E%2Fsync%2F34b7dfb801054415308bebbdb903a79ca66b425e.gif?generation=1601331282193511\&alt=media)

### Block Nested Loop Join (B=4)

![](https://678656433-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MFVQnrLlCBowpNWJo1E%2Fsync%2F6417e98132194a70acfd2b305f32d6ed096028bc.gif?generation=1601331282191017\&alt=media)
