A Heap file allows us to retrieve records:
- by specifying the rid, or
- by scanning all records sequentially
Sometimes, we want to retrieve records by specifying the values in one or more fields, e.g.,
- Find all students in the “CS” department
- Find all students with a gpa > 3
Indexes are file structures that enable us to answer such value-based queries efficiently.