Cost formula

For a nested-loop join with two tables, the formula for estimating the cost is:

With additional tables, the cost of a nested-loop join is: