Example
Pass 1: (essentially, access-path selection)
- Sailors: B+ tree matches ratingɱ, and is probably cheapest. However, if this selection is expected to retrieve a lot of tuples, and index is unclustered, file scan may be cheaper.
- Still, B+ tree plan kept (tuples are in rating order).
- Reserves: B+ tree on bid matches bid=100; cheapest.
Pass 2: We consider each plan retained from Pass 1 as the outer, and consider how to join it with the (only) other relation.
- e.g., Reserves as outer: Hash index can be used to get Sailors tuples that satisfy sid = outer tuple’s sid value.