Table of Contents

About

The set cartesian product applied to a set of row (ie a tables) create all pairs of tuples (row).

A cross-join (also called Cartesian join) occurs when a request does not have a join condition between two tables. We say that the inner table is not driven from (not dependent on) the outer table.

That creates a cartesian product of the tables involved in the join. The size of a cartesian product is the number of rows in the first table multiplied by the number of rows in the second table.

In other word, if the inner table's access path is independent of the outer table, then the same rows are retrieved for every iteration of the outer loop.

The cartesian product in named for Rene Descartes.

Symbol

A cross (times) <MATH> \LARGE R1 \times R2 </MATH>

where:

Size

The size of this cross-join is then the size of the first table (R1) multiplied by the size of the second table (R2).

Example

Find all pairs of similar images/tweets/songs

Sql

See SQL - Cross Join / Cartesian Product / Cross Product