Monday, 7 September 2015

File organization in DBMS - Heap file organization

Heap file organization / Unordered file organization

Heap File Organization


  • Simplest type of file organization.
  • Also called as, unordered file organization.
  • To make it simple, new records are normally inserted at the end of the file. If the last page is full, then the new record can go into the next block.
  • No order is required in storing the records.
  • Typically single file is maintained for every database table.

 

Operations that are supported:


  • Insert records – new records can be inserted at the last page of the file. For efficient insertion, we may keep track of free space in the file pages, and insert new records in the available space as well.
  • Delete records – in a database table, all the records are given unique row IDs. We can find the block in which the record that is to be deleted is stored, and then we can delete the record. Frequent deletion of records would create much free space in a file, and this need periodical reorganization of the file.
  • Scan records/file – the row IDs would be used to locate and read a record from a file. Linear search is important to search for a record [also for locating a record that is to be deleted].

 

Advantages:


  • Simple file organization.
  • Insertion becomes easy.
  • Best method for bulk loading data into a relation.

 

Disadvantages:


  • As a heap file uses no particular ordering, we are able to locate the required record using linear search only. It would take more time and make retrieval slow.
  • Frequent deletions of records would need periodical file reorganization.
  • Inefficient for larger database tables.
  • To boost the performance, proper memory management is required. This is the extra overhead in handling records.



2 comments:

SQL exercises for beginners one

SQL Exercises for Beginners / Simple SQL Exercises with Answers / Solved SQL exercises / SQL solved exercises with simple conditions / So...