Database Management: Department of Computer Science, School of Computing Sciences
Database Management: Department of Computer Science, School of Computing Sciences
Database Management: Department of Computer Science, School of Computing Sciences
II B. Sc. B
Department of Computer Science,
School of Computing Sciences,
St. Joseph’s College (Autonomous),
Trichy – 2.
Unit II
• Storage Structure
• Introduction
• Introduction
• Relations
• Domains
Introduction
• A database system provides an ultimate view of the stored data.
• Data in the form of bits, bytes get stored in different storage devices.
• For storing the data, there are different types of storage options available. These storage
types differ from one another as per the speed and accessibility. There are the following
types of storage devices used for storing the data:
• Primary Storage
• Secondary Storage
• Tertiary Storage
Types of Data Storage
• Primary Storage
• It is the primary area that offers quick access to the stored data.
• volatile storage (power cut or a crash, the data also get lost)
• Main memory and cache are the types of primary storage.
• Secondary Storage
• Secondary storage is also called as Online storage.
• It is the storage area that allows the user to save and store data
permanently.
• This type of memory does not lose the data due to any power failure or
system crash.
• That's why we also call it non-volatile storage.
• Tertiary Storage
• It is the storage type that is external from the computer system.
• It has the slowest speed.
• But it is capable of storing a large amount of data.
• It is also known as Offline storage.
• Tertiary storage is generally used for data backup.
File Organization and Addressing Schemes
• The File is a collection of records.
• Using the key system allows to access the records.
• The type and frequency of access can be determined by the type of file organization.
• File organization is a logical relationship among various records. It defines how file
records are mapped onto disk blocks
• 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.
• Approach to map the database to the file
1) use the several files and store only one fixed length record in any given file.
2) structure the files so that it can contain multiple lengths for records.
• Files of fixed length records are easier to implement than the files of variable length
records.
File Organization and Addressing Schemes
• There are number of methods to organize Files.
• These methods can be categorized based on access or selection.
• Programmer can decide the best-suited method based to the requirement.
a) Sequential Organization
b) Indexed Sequential Organization
c) Direct Organization of File
d) Interface Indexing
e) Hashing Scheme of File Organization
File Organization and Addressing Schemes
Sequential Organization
• Easiest way of file organization
• Files are stored sequentially
• Implemented in two ways:
• Pile File Method
• Record is stored in a sequence
• Inserted in the order in which they are inserted into tables.
• Sorted File Method
• 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 primary key or any other key.
• On modification of any record, it will update the record and
then sort the file
File Organization and Addressing Schemes
Sequential Organization
• Disadvantages
• Sorted file method takes more time and space for sorting the
records.
File Organization and Addressing Schemes
Indexed Sequential Organization
• The index provides for random access to records, while the sequential
nature of the file provides easy access to the subsequent records as
well as sequential processing.
Interface Indexing
• An indexed file contains records ordered by a record key.
• A record key uniquely identifies a record and determines the
sequence in which it is accessed with respect to other records.
• Each record contains a field that contains the record key.
• An indexed file can also use alternate indexes, that is, record
keys that let you access the file using a different logical
arrangement of the records.
• The possible record transmission (access) modes for indexed
files are sequential, random, or dynamic.
• When indexed files are read or written sequentially, the
sequence is that of the key values.
File Organization and Addressing Schemes
SET DIFFERENCE
• - is used to denote set difference operation
• Tuples in one relation/ not in other relation
• R1 – R2
Example
• Find all the customers name/ details (attributes) – having an account and
not a loan
π customer_name (depositor) - π customer_name (borrower)
Thank You
….