Hash Files vs Index Files

Leave a comment

February 8, 2013 by Ozgur Ozden

We have different file structure models, let us take a look at these models.Image
Indexed Files:
Sequential files are very good design strategy for storing data. But the problem arises when we try to retrieve these data and fast. Common solution to this problem is to use an index file.  “An index for a file contains a list of the keys stored in the file along with entries indicating where the record containing each key is stored” (Brookshear, 2012).  So in order to find a specific record one need to look for the key in the index file and then retrieve the block of information. Index file is usually stored on a different location on the storage. In order to increase the speed of the process index file is transferred to main memory before the processing. Different types of index files can be given as
• Single-Level Indexes
– Primary
– Secondary
– Clustering
• Multi-Level Indexes
– ISAM
– B Trees
– B+ Trees

Hash Files
This structuring system is very useful when files are not sequential.  system can be described as data storage spaces are divided into compartments called buckets. Data then distributed to these buckets depending on the key value calculated by hash function. At this point good calculated hash function is very important because this will prevent clustering.
İf we compare these two

  • İndex file should be the choice if fast access is needed
  • Hashed system is more suitable if more security is demanded.
  • İt is better to use index file for structured data.
  • Size of the index file is usually bigger.
  • Disk space can be manage better by means of Hash files.
  • Suitable examples for index files can be OS, file systems, E-mails
  • Suitable examples for hash files can be music, video, image formats.

Depending on these comparisons and the project, either index or hash file can be selected for the system.

References:
1-  Comparison Between Random (Hashed) File and Index File , [Online] Available from:http://www.pmbatch.com/blog/comparison-random-hashed-file-index-file/ (Accessed 31 January 2013)
2- Difference Between DBMS and File System [Online] Available from:  (Accessed 31 January 2013)
3- Brookshear, J. G. (2012) Computer Science, An Overview (11th Ed.) Pearson Education Inc., Boston, MA

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: