Direct File Organization
- It is a common technique used for fast accessing of records on secondary storage.
- Moreover, Records of a file divided among buckets.
- A bucket is either one disk block or cluster of contiguous blocks.
- Also, A hashing function maps a key into a bucket number. The buckets numbered 0, 1,2…b-1.
- Similarly, A hash function f maps each key value into one of the integers 0 through b – 1.
- If x is a key, f(x) is the number of the bucket that contains the record with key x.
- The blocks making up each bucket could either contiguous blocks or they can chain together in a linked list.
- Translation of bucket number to disk block address done with the help of bucket directory. It gives the address of the first block of the chained blocks in a linked list.
- Hashing quite efficient in retrieving a record on hashed key. Also, The average number of block accesses for retrieving a record.
- Thus the operation is b times faster (b = number of buckets) than the unordered file.
- To insert a record with key value x, the new record can add to the last block in the chain for bucket f(x). Moreover, If the record does not fit into the existing block, the record stored in a new block and this new block added at the end of the chain for bucket f(x).
- Also, A well designed hashed structure requires two block accesses for most operations