1
Database Administration and
Management
CIT- 503 4(3-1)
Major & Compulsory
Database Administration and
Management
This Week Contents
File Organization Concepts
File Organization Concepts
File organization in DBMS:
File organization in database
administration and management refers
to the way data is stored, arranged,
and accessed in storage systems.
Proper file organization ensures
efficient data retrieval, update, and
storage, playing a critical role in
database performance and reliability.
File Organization Concepts
File organization in DBMS:
A database consists of a huge amount
of data.
The data is grouped within a table in
RDBMS, and each table has related
records.
A user can see that the data is stored
in the form of tables, but in actuality,
this huge amount of data is stored in
physical memory in the form of files.
File Organization Concepts
What is a File?
A file is named a collection of related
information that is recorded on
secondary storage such as magnetic
disks, magnetic tapes and optical
disks.
File Organization Concepts
What is File organization?
File Organization refers to the logical
relationships among various records that
constitute the file, particularly with respect
to the means of identification and access to
any specific record.
In simple terms, Storing the files in a
certain order is called File Organization.
File Structure refers to the format of the
label and data blocks and of any logical
control record.
File Organization Concepts
The Objectives of File organization
It helps in the faster selection of
records i.e. it makes the process faster.
Different Operations like inserting,
deleting, and updating different records
are faster and easier.
It prevents us from inserting duplicate
records via various operations.
It helps in storing the records or the
data very efficiently at a minimal cost.
File Organization Concepts
The Objectives of File organization
It helps in the faster selection of
records i.e. it makes the process faster.
Different Operations like inserting,
deleting, and updating different records
are faster and easier.
It prevents us from inserting duplicate
records via various operations.
It helps in storing the records or the
data very efficiently at a minimal cost.
File Organization Concepts
Types of File Organizations
Various methods have been introduced
to Organize files.
These particular methods have
advantages and disadvantages on the
basis of access or selection.
Thus it is all upon the programmer to
decide the best-suited file Organization
method according to his requirements.
File Organization Concepts
Some Types of File Organizations
Sequential File Organization
Heap File Organization
Hash File Organization
B+ Tree File Organization
Clustered File Organization
ISAM (Indexed Sequential Access
Method)
File Organization Concepts
Sequential File Organization
The easiest method for file
Organization is the Sequential method.
In this method, the file is stored one
after another in a sequential manner.
There are two ways to implement this
method:
File Organization Concepts
Pile File Method
This method is quite simple, in which
we store the records in a sequence i.e.
one after the other in the order in which
they are inserted into the tables.
File Organization Concepts
Pile File Method
Insertion of the new record: Let the R1, R3,
and so on up to R5 and R4 be four records in
the sequence.
Here, records are nothing but a row in any
table.
Suppose a new record R2 has to be inserted in
the sequence, then it is simply placed at the
end of the file.
File Organization Concepts
Sorted File Method
In this method, As the name itself suggests
whenever a new record has to be inserted, it is
always inserted in a sorted (ascending or
descending) manner. The sorting of records
may be based on any primary Key or any other
key.
File Organization Concepts
Sorted File Method
Insertion of the new record: Let us assume
that there is a preexisting sorted sequence of
four records R1, R3, and so on up to R7 and R8.
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.
File Organization Concepts
Advantages of Sequential File Organization
Fast and efficient method for huge amounts of data.
Simple design.
Files can be easily stored in magnetic tapes i.e.
cheaper storage mechanism.
File Organization Concepts
Disadvantages of Sequential File
Organization
Time wastage as we cannot jump on a particular record
that is required, but we have to move in a sequential
manner which takes our time.
The sorted file method is inefficient as it takes time
and space for sorting records.
File Organization Concepts
Heap File Organization
Heap File Organization works with data
blocks. In this method, records are inserted at
the end of the file, into the data blocks.
No Sorting or Ordering is required in this method.
File Organization Concepts
Heap File Organization
If a data block is full, the new record is stored
in some other block, Here the other data block
need not be the very next data block, but it
can be any block in the memory.
It is the responsibility of DBMS to store and
manage the new records.
File Organization Concepts
Heap File Organization
File Organization Concepts
Heap File Organization
Insertion of the new record: Suppose we have
four records in the heap R1, R5, R6, R4, and R3, and
suppose a new record R2 has to be inserted in the
heap then, since the last data block i.e data block 3
is full it will be inserted in any of the data blocks
selected by the DBMS, let’s say data block 1.
File Organization Concepts
Heap File Organization
File Organization Concepts
Heap File Organization
If we want to search, delete or update data in
the heap file Organization we will traverse the
data from the beginning of the file till we get
the requested record.
Thus if the database is very huge, searching,
deleting, or updating the record will take a lot
of time.
File Organization Concepts
Advantages of Heap File Organization
Fetchingand retrieving records is faster than
sequential records but only in the case of small
databases.
When there is a huge number of data that needs
to be loaded into the database at a time, then
this method of file Organization is best suited.
File Organization Concepts
Disadvantages of Heap File
Organization
The problem of unused memory blocks.
Inefficient for larger databases.
File Organization Concepts
Hash File Organization in DBMS
Hashing techniques are used to retrieve specific data.
Searching through all index values to reach the desired
data becomes very inefficient, in this scenario we may
use hashing as an efficient technique for locating
desired data directly on disk without using an index
structure.
HashFile Configuration is also known as Direct file
configuration.
File Organization Concepts
What is Hash File Organization?
Hash file organization may be a strategy of
putting away and getting to information in a
record employing a hash work to calculate the
address of the information within the record.
This permits for fast recovery of information
based on a key.
In Hashing we mainly refer the following terms:
File Organization Concepts
What is Hash File Organization?
Data Bucket: A data bucket is a storage
location where records are stored. These
buckets are also considered storage units.
Hash Index: The prefix of the entire hash
value is used as the hash index. Each hash
index has a depth value that indicates the
number of bits used to calculate the hash
function.
File Organization Concepts
What is Hash File Organization?
Hash Function: A hash function is a
mapping function that maps all search keys
to actual record addresses. Generally, a
hash function uses a primary key to
generate a hash index (address of a data
block). Hash functions range from simple to
complex mathematical functions.
File Organization Concepts
Hashing Technique
Data is stored in data blocks at addresses
generated using a hash function.
The location where these records are stored is
called a data block or data bucket.
In this organization, records are stored at known
addresses rather than by location.
To write a record, the address is first calculated
by applying a mathematical function to obtain
the record's key.
File Organization Concepts
Hashing Technique
The data record is saved to the generated address.
In this case, the records are stored in BUCKETS,
which are storage units that can store one or more
records.
For example, the hash function h(K) = K mod 7
hashes 35 and 43 to addresses 0, 1, as shown
below,
43 mod 7 = 1 35 mod 7 = 0
File Organization Concepts
Hashing Types
There are two types of hashing such as:
Static Hashing
Dynamic Hashing
File Organization Concepts
Static Hashing
If you specify a search key value, the hash
function always calculates the same address.
If you want to generate an address that uses
a mod 5 hash function, only 5 different
values will be generated.
The output address of this function is always
the same.
The number of available buckets always
remains constant.
File Organization Concepts
Static Hashing
Bucket addresses generated with static
hashing always remain the same.
For example,
If you use the hash function mod(5) to
get the address for customer ID =75,
you will always get the same bucket
address 0
File Organization Concepts
Static Hashing
The bucket address does not change in this
scenario.
75 mod 5= 0
66 mod 5 = 1
82 mod 5 = 2
93 mod 5 =3
104 mod 5 = 4
and so on.
File Organization Concepts
Static Hashing
File Organization Concepts
Dynamic Hashing
Indynamic hashing, Data buckets grow or shrink
(dynamically added or removed) as the data set
grows or shrinks.
Dynamic Hashing is also known as Extended Hashing.
Dynamic hashing requires the hash function to
generate a large number of values.
File Organization Concepts
Dynamic Hashing
Forexample, there are three data sets: Data1,
Data2, and Data3.
Thehash function produces three addresses 1010,
1011, and 1001.
Thisstorage method only considers part of this
address, specifically the first bit that stores the data.
File Organization Concepts
Dynamic Hashing
So we try to load three of them into
addresses 0 and 1.
h(Data 1) -> 1010
h(Data 2) -> 1011
h(Data 3) -> 1001
File Organization Concepts
Dynamic Hashing
File Organization Concepts
Dynamic Hashing
But the problem is that there are no
bucket addresses left for Data3.
Buckets must be dynamically expanded
to support D3.
Therefore, we change the address by 2
bits instead of 1 bit and update the
existing data to have a 2-bit address.
Next, try to record data 3.
File Organization Concepts
Dynamic Hashing
File Organization Concepts
Conclusion
Hashing is an efficient technique for
locating desired data directly on disk
without using index structures.
Hashing techniques are useful when
you want to retrieve specific data as
when searching through all index
values to reach the desired data
becomes very inefficient.
File Organization Concepts
Topic 04
Completed
45
Database Administration and
Management
Course Contents Course Contents
Completed Completed
Introduction to Recovery
advance data models techniques
such as object,
Query processing
relational
object oriented and optimization
File organizations Database
concepts Programming
Transactional Integrity and
processing and security
Concurrency control
techniques 46
Database Administration and
Management
Course Contents Course Contents
Completed Completed
Database Emerging
Administration research trends
Physical database in database
design and tuning systems.
Distributed
database systems
47
Database Administration and
Management
Total No of Per Week
Topics Topics
Coverage
Rate
12
0.75
48
Database Administration and
Management
Marks %Age
Division 5%
Attendance 5%
Assignments 5%
Quiz 5%
Presentation 30%
Mid Term Exam 50%
Final Term Exam
49
50