Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Indexed Sequential Access

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 10

Indexed Sequential Access

Chapter 10
Indexed Sequential Access
• Up to this point, we have had to choose between viewing a file from an
indexed point of view or from a sequential point of view.

• Here, we are looking for a single organizational method that provides


both of these views simultaneously.

• Why care about obtaining both views simultaneously? If an application


requires both interactive random access and cosequential batch
processing, both sets of actions have to be carried out efficiently. (E.g.,
a student record system at a University).
Maintaining a Sequence Set: The Use of
Blocks
• A sequence set is a set of records in physical key order which is such
that it stays ordered as records are added and deleted.

• Since sorting and resorting the entire sequence set as records are
added and deleted is expensive, we look at other strategies. In
particular, we look at a way to localize the changes.

• The idea is to use blocks that can be read into memory and rearranged
there quickly. Like in B-Trees, blocks can be split, merged or their
records re-distributed as necessary.
Maintaining a Sequence Set: The Use of
Blocks
• Using blocks, we can thus keep a sequence set in order by key without
ever having to sort the entire set of records.

• However, there are certain costs associated with this approach:


• A Blocked file takes up more space than an unblocked file because of internal
fragmentation.
• The order of the records is not necessarily physically sequential throughout
the file. The maximum guaranteed extent of physical sequentially is within a
block.
Sequence Set : Example
• Block of Order 5
Sequence Set : Example
Maintaining a Sequence Set: The Use of
Blocks
• An important aspect of using blocks is the choice of a block size.
There are 2 considerations to keep in mind when choosing a block
size:

• The block size should be such that we can hold several blocks in memory at
once

• the block size should be such that we can access a block without having to
bear the cost of a disk seek within the block read or block write operation.
An Index over Sequence Set : B+ Tree
• Each of the blocks we created for our Sequence Set contains a range of
records that might contain the record we are seeking.

• We can construct an index for these blocks.

• The combination of this kind of index with the sequence set of blocks
provides complete indexed sequential access.

• We can use a B+ Tree which is a B-Tree index plus a sequence set that holds
the records.
An Index over Sequence Set : B+ Tree

Changes localized to
single blocks in the
sequence set:
Make the changes to
the sequence set and
to the index set.
Common Block Size Between index set and
sequence set
• The index set node size and sequence set block size are usually the
same : why ?

• Because usually they are stored on the same file

• Easy Buffering Schema

You might also like