Using an Index for Selections
Cost depends on #qualifying tuples, and clustering.
- Cost of finding qualifying data entries (typically small) plus cost of retrieving records.
- In example, assuming uniform distribution of phones, about 54% of tuples qualify (500 pages, 50000 tuples). With a clustered index, cost is little more than 500 I/Os; if unclustered, up to 50000 I/Os!
Important refinement for unclustered indexes:
1. Find sort the rid’s of the qualifying data entries.
2. Fetch rids in order. This ensures that each data page is looked at just once (though # of such pages likely to be higher than with clustering).