Sorted Files
Scan:
- The cost is B(D +RC) because all pages must be examined.
- Note that this case is no better or worse than the case of unordered files.
- However, the order in which records are retrieved corresponds to the sort order,that is, all records in age order, and for a given age, by sal order.
Search with Equality Selection:
- We assume that the equality selection matches the sort order (age, sal).
- In other words, we assume that a selection condition is specified on at least the first field in the composite key (e.g., age = 30).
- If not (e.g., selection sal = 50 or department = "Toy"), the sort order does not help us and the cost is identical to that for a heap file.
Cost (logB) if matches 1 and 2Else it is same as SCAN
Search with range selection:
Cost (logB) if matches 1 and 2
Else it is same as SCAN


No comments:
Post a Comment