What are hashed files and indexed file organization(DBMS)?

DBMSDatabaseBig Data Analytics

Let us begin by understanding the hashed file organisation.

Hashed File Organisation

Hashed file organisation is also called a direct file organisation.

In this method, for storing the records a hash function is calculated, which provides the address of the block to store the record. Any type of mathematical function can be used as a hash function. It can be simple or complex.

Hash function is applied to columns or attributes to get the block address. The records are stored randomly. So, it is also known as Direct or Random file organization.

If the generated hash function is on the column which is considered as key, then the column can be called as hash key and if the generated hash function is on the column which is considered as non-key, then the column can be called as hash column.

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.

raja
Published on 08-Jul-2021 07:31:32
Advertisements