0% found this document useful (0 votes)
21 views5 pages

File Organization

The document discusses different methods of organizing records in files, including heap file organization, sequential file organization, hash/direct file organization, and clustered file organization. It provides details on how each method works and their advantages and disadvantages.

Uploaded by

Jawad Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

File Organization

The document discusses different methods of organizing records in files, including heap file organization, sequential file organization, hash/direct file organization, and clustered file organization. It provides details on how each method works and their advantages and disadvantages.

Uploaded by

Jawad Ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CIT-503(Database Administration and Management )

File organization Concepts


File:
A file is a sequence of records stored in binary format. A disk drive is formatted
into several blocks that can store records. File records are mapped onto those
disk blocks.

File Organization:
File organization is used to describe the way in which the records are stored in
terms of blocks, and the blocks are placed on the storage medium. Files of fixed
length records are easier to implement than the files of variable length records.

Database File Record

Attributes
Objective of file organization
o It contains an optimal selection of records, i.e., records can be selected as
fast as possible.
o To perform insert, delete or update transaction on the records should be
quick and easy.
o The duplicate records cannot be induced as a result of insert, update or
delete.
o For the minimal cost of storage, records should be stored efficiently.
CIT-503(Database Administration and Management )

Organization of Records in Files


Several of the possible ways of organizing records in files are:

1)Heap File Organization System:


It is also known as unordered File organization. Any record can be placed
anywhere in the file where there is space for the record. There is no ordering of
records. When a file is created using Heap File Organization, the Operating
System allocates memory area to that file without any further accounting details.
File records can be placed anywhere in that memory area. It is the responsibility
of the software to manage the records. Heap File does not support any ordering,
sequencing, or indexing on its own.

Benefits of Heap File Organization


• it's an efficient way to organize files for bulk insertion. This method is most
effective when a large volume of data needs to be loaded into the database
simultaneously.
• Fetching records and retrieving them is faster in a small database than in
sequential records.
CIT-503(Database Administration and Management )

Drawbacks of Heap File Organization


o As it takes time to find or modify a record in a large database, this method
is relatively inefficient.
o For large or complex databases, this type of organization may not be
suitable.

2)Sequential file organization:


Every file record contains a data field (attribute) to uniquely identify that record.
In sequential file organization, records are placed in the file in some sequential
order based on the unique key field or search key. Practically, it is not possible to
store all the records sequentially in physical form.

Advantages of Sequential File Organization


1. It is simple to adapt method. The implementation is simple compared to
other file organization methods.
2. It is fast and efficient when we are dealing with huge amount of data.
3. This method of file organization is mostly used for generating various reports
and performing statistical operations on data.
4. Data can be stored on a cheap storage devices.

Disadvantages of Sequential File Organization


1. Sorting the file takes extra time and it requires additional storage for sorting
operation.
2. Searching a record is time consuming process in sequential file organization
as the records are searched in a sequential order.

3)Hash/Direct file organization


A hash function is computed on some attribute of each record. The result of the
hash function specifies in which block of the file the record should be placed.
CIT-503(Database Administration and Management )

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.

Advantages of Hash File Organization


1. This method doesn’t require sorting explicitly as the records are
automatically sorted in the memory based on hash keys.
2. Reading and fetching a record is faster compared to other methods as the
hash key is used to quickly read and retrieve the data from database.
3. Records are not dependant on each other and are not stored in consecutive
memory locations so that prevents the database from read, write, update,
delete anomalies.

Disadvantages of Hash File Organization


1. Can cause accidental deletion of data, if columns are not selected properly
for hash function. For example, while deleting an
Employee "Steve" using Employee_Name as hash column can cause
accidental deletion of other employee records if the other employee name is
also "Steve". This can be avoided by selecting the attributes properly, for
example in this case combining age, department or SSN with the
employee_name for hash key can be more accurate in finding the distinct
record.
2. Memory is not efficiently used in hash file organization as records are not
stored in consecutive memory locations.
3. If there are more than one hash columns, searching a record using a single
attribute will not give accurate results.

4)Clustered File System:


Clustered file organization is not considered good for large databases. In this
mechanism, related records from one or more relations are kept in the same disk
block, that is, the ordering of records is not based on primary key or search key.
CIT-503(Database Administration and Management )

Clusters are created when two or more records are saved in the same file. There
will be two or more tables in the same block of data in these files, and key
attributes that are used to link these tables together will only be kept once. This
strategy lowers the cost of searching several files for various records.

When combining tables with the same condition on a regular basis, the cluster file
organization is employed. Only a few records from both tables will be returned by
these joins.

Pros of Cluster File Organization


• When there are many requests for connecting tables with the same joining
condition, the cluster file organization is employed.

Cons of Cluster File Organization


• For a very large database, this approach has a low performance.
• If the joining condition changes, this method will no longer work. When we
update the joining condition, traversing the file takes a long time.

You might also like