Hash File Organization

 

Hash File Organization

Hash File Organization uses the computation of hash function on some fields of the records. The hash function's output determines the location of disk block where the records are to be placed.

DBMS Hash File Organization

When a record has to be received using the hash key columns, then the address is generated, and the whole record is retrieved using that address. In the same way, when a new record has to be inserted, then the address is generated using the hash key and record is directly inserted. The same process is applied in the case of delete and update.

In this method, there is no effort for searching and sorting the entire file. In this method, each record will be stored randomly in the memory.

DBMS Hash File Organization

Indexed file organisation

A record key is used in indexed file organisation to record the data. Record key is a unique ID which identifies a record and can also tell the sequence of the record.

Record key is present in a field which is contained in each record. A record key for a record may be an employee number.

Alternate indexes can also be in an indexed file system which means different arrangements of records can be accessed by the same record keys.

For example, files can be accessed through the employee department rather than employee ID.

Advantages of indexed over hash

The advantages of indexed file organisation over hashed file organisation are as follows −

  • In indexed file organisation, data records can be easily processed, unlike hashed file organisation in which data is stored randomly and is a big mess.

  • Multiple records can be accessed using the same key in indexed file organisation while this is not the case with hashed file organisation.

Advantages of hash over indexed

The advantages of hashed file organization over indexed file organization are as follows −

  • In hashed file organization, the records need not be sorted after any transaction. While in an indexed file organization the reorganization needs to be done from time to time to get rid of deleted records.

  • There is an extra cost to maintain index in indexed file organization, while this is not the case in hashed file organization.



Post a Comment

© DBMS. The Best Codder All rights reserved. Distributed by