0% found this document useful (0 votes)
33 views

Lecture 3.3.3 Sequential, Relative

This document summarizes different types of file organization methods for storing data records in a database. It describes sequential file organization which stores records sequentially in either a pile file or sorted method. It also describes direct (random) file organization which stores records at known addresses allowing direct access. The pros and cons of each method are provided. Sequential access is simple but inefficient for random retrieval while direct access allows immediate access but is more complex.

Uploaded by

borab25865
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Lecture 3.3.3 Sequential, Relative

This document summarizes different types of file organization methods for storing data records in a database. It describes sequential file organization which stores records sequentially in either a pile file or sorted method. It also describes direct (random) file organization which stores records at known addresses allowing direct access. The pros and cons of each method are provided. Sequential access is simple but inefficient for random retrieval while direct access allows immediate access but is more complex.

Uploaded by

borab25865
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

UNIVERSITY INSTITUTE OF

ENGINEERING
DEPARTMENT OF COMPUTER SCIENCE
AND ENGG.

Bachelor of Engineering (Computer Science & Engineering)


DATA STRUCTURES 21CSH-211

DISCOVER . LEARN . EMPOWER


1
Types of file organization:

2
Sequential File Organization
• This method is the easiest method for file organization. In this method, files are
stored sequentially. This method can be implemented in two ways:
• 1. Pile File Method:
• It is a quite simple method. In this method, we store the record in a sequence,
i.e., one after another. Here, the record will be inserted in the order in which
they are inserted into tables.
• In case of updating or deleting of any record, the record will be searched in the
memory blocks. When it is found, then it will be marked for deleting, and the
new record is inserted.

3
• Insertion of the new record:
• Suppose we have four records R1, R3 and so on upto R9 and R8 in a
sequence. Hence, records are nothing but a row in the table.
Suppose we want to insert a new record R2 in the sequence, then it
will be placed at the end of the file. Here, records are nothing but a
row in any table.

4
Sorted File Method:

• In this method, the new record is always inserted at the file's end,
and then it will sort the sequence in ascending or descending order.
Sorting of records is based on any primary key or any other key.
• In the case of modification of any record, it will update the record
and then sort the file, and lastly, the updated record is placed in the
right place.

5
• Insertion of the new record:
• Suppose there is a preexisting sorted sequence of four records R1,
R3 and so on upto R6 and R7. Suppose a new record R2 has to be
inserted in the sequence, then it will be inserted at the end of the
file, and then it will sort the sequence.

6
Pros of sequential file organization

• It contains a fast and efficient method for the huge amount of data.
• In this method, files can be easily stored in cheaper storage
mechanism like magnetic tapes.
• It is simple in design. It requires no much effort to store the data.
• This method is used when most of the records have to be accessed
like grade calculation of a student, generating the salary slip, etc.
• This method is used for report generation or statistical calculations.

7
Cons of sequential file organization

• It will waste time as we cannot jump on a particular record that is


required but we have to move sequentially which takes our time.
• Sorted file method takes more time and space for sorting the
records.

8
Direct (Random) File Organization
• Records are read directly from or written on to the file.
• The records are stored at known address.
• Address is calculated by applying a mathematical function to the key
field.
Direct (Random) File Organization
• A random file would have to be stored on a direct access backing
storage medium e.g. magnetic disc, CD, DVD

• Example : Any information retrieval system. Eg Train timetable


system.
Advantages
• Any record can be directly accessed.
• Speed of record processing is very fast.
• Up-to-date file because of online updating.
• Concurrent processing is possible.
Disadvantages
• More complex than sequential
• Does not fully use memory locations
• More security and backup problems
Direct access file organization

• Direct access file is also known as random access or relative file


organization.
• In direct access file, all records are stored in direct access storage
device (DASD), such as hard disk. The records are randomly placed
throughout the file.
• The records does not need to be in sequence because they are
updated directly and rewritten back in the same location.
• This file organization is useful for immediate access to large amount
of information. It is used in accessing large databases.
• It is also called as hashing.
13
Advantages of direct access file organization
• Direct access file helps in online transaction processing system
(OLTP) like online railway reservation system.
• In direct access file, sorting of the records are not required.
• It accesses the desired records immediately.
• It updates several files quickly.
• It has better control over record allocation.

14
Disadvantages of direct access file
organization
• Direct access file does not provide back up facility.
• It is expensive.
• It has less storage space as compared to sequential file.

15
THANK YOU

16

You might also like