Nested block is optimized independently, with the outer tuple considered as providing a selection condition.
Outer block is optimized with the cost of `calling’ nested block computation taken into account.
Implicit ordering of these blocks means that some good strategies are not considered. The non-nested version of the query is typically optimized better.
Nested block to optimize:
Equivalent non-nested query:
FROM Sailors S, Reserves R