Database Reference
In-Depth Information
Delete.
Identify the file and the block where the record resides. Delete the record
from the block and free up the space.
Equality selection.
Fetch only the records where the value of a specific attribute
equals a given value.
Range selection.
Fetch only those records where the value of a specific attribute
is within a given range of values.
Scan.
Full file scan. Fetch all the records in a file.
How can you arrange the records in a file? Whether you keep the records in a
certain sequence of values of a specific attribute or just throw the records into the
file in a random fashion, the arrangement of records in a file affects the types of
data operations listed above. The arrangement of records in a file determines how
each record gets stored in storage blocks. Therefore, how you arrange the records
in a file becomes important and influences efficiency of data access. The database
administrator must choose the right arrangement of records in each file.
DBMSs support several methods for arranging records in a file. File organization
refers to the way records are arranged in a file. There are three basic file organiza-
tions: heap, sequential, and hash. Each file organization affects the database oper-
ations in a certain way. Let us examine each of the basic organizations and note the
circumstances for which each organization is best suited.
Heap or Pile Organization
•
Records placed in the order of creation
•
No ordering of records
•
Usually single file for each relational table
•
New record inserted on last block of file
•
Inserting records very efficient
•
Searching very inefficient—linear search from beginning to end of file
•
Deleting leaves wasted space in the block
•
Useful for collecting and storing data for later use
•
Good for database backup and transportation of data
•
Best if most common operation is full file scan
Sequential Organization
•
Records sorted on some search key field—only one search key field per file
•
Records placed in sequence or chained together in the order of data values in
search key field
•
Allows records to be read in search key order
•
Fast retrieval in search key order
•
Inserting consecutive records takes place in the same block or overflow blocks
•
Deletion leaves wasted space in the block
Search WWH ::
Custom Search