You are on page 1of 6

File Structure and Algorithms

Assignment 1 Amrith Krishna,


Submitted by: Roll No: 5, S5 CSE –A

Q. How Does Index Placement affect the performance of Indexed


sequential files? Explain options available to designer and reason
s for the choice of each.

Ans:
Indexed Sequential Files: A file which has its records sequentially ordered,
and if there exists an index known as clustering index whose search key also
defines the sequential order of the file then that file is an indexed sequentially
file.

An index record/index entry contains a search-key value and pointers to one


or more records with that value as their search-key value.

In general while designing a database system with indices, the following


constraints are to be kept in mind by the designer.

 Access types: the types of access that are supported efficiently. It can
include finding records with a specified attributed value and finding
records whose values fall in a specified range.
 Access time: The time taken by a technique to find a particular data
item.
 Insertion Time: The time it takes to insert a new data item.
 Deletion time: time taken to delete an existing item.
 Space Overhead: The additional space occupied an index
structure.

While dealing with an Indexed sequential file, Insertion and Deletion are
always a major problem.

If we need to insert a new entry then we have to not only move records some
records but also change some index entries. One of the techniques that is
employed to resolve this is to have an unordered overflow file which will
contain newly added items.

These items are put to correct positions while file reorganisation is done
sometime later. But this technique can be employed only in those fields where
up-to-date data is not of utmost importance or else to increase the algorithm
complexity by adding a linear search algorithm for the overflow block.

Deleted data are done away with deletion markers.

Two mutually-complimentary constraints that always concern a designer when


dealing with Indexed sequential files are the trade-off between access-time
and space overhead.
If Data access time is a major concern than the cost then it is better to have
index for each unique key value resulting in dense indices.

But if the database is really huge and so is the chance for index to become if
we use dense indices and so does space occupied by it. Then we use a
technique where an index-record appears for only some of search key values.
This will considerably reduce the space taken by index .

Still if we have larger sparse indices we can go for multilevel indices where we
can keep an index for a set of inner indices and this concept can be extended
to any number of levels.

Though selection of each of these type of indices is purely application specific,


a good compromise is to have a sparse index with one index entry per block,
as the dominant cost in processing a database request is the time it takes to
bring a block from disk into main memory.

Index placement in indexed sequential files:


There are essentially two types of indices we can use.

Dense Index:
An Index record appears for every search-key value in the file. The index
record contains the search-key value. The rest of the records with the same
search-key value would be stored sequentially after the first record, since
because the index is a clustering one.
A-132 FISAT 900
FISAT A-217 FISAT 850
A-218 FISAT 875
Rajagiri
A-456 Rajagiri 923
SCMS A-111 SCMS 567
A-567 SCMS 765
ToCH
A-432 ToCH 876
A-223 ToCH 765

Features of Dense Indices

 Access time is pretty fast in these kind of indices, and so provides high
performance even in machines with slower secondary storage devices
 Space intensive: Requires large amount of size for indices as well.
Situations may arise where index itself can’t be contained in the
memory at once.
 This can affect the performance of system due to time taken for
interaction between and primary and secondary memory

Sparse Indices:

An index record appears for only some of the search-key values.


Each index record contains a search-key value and a pointer to the first
data record with that search-key value. To locate a record, we find the
index entry with the largest search-key value that is less than or equal
to search-value. We start at the record pointed to by that index entry,
and follow the pointers in the file until we find the desired record.

A-132 FISAT 900


FISAT A-217 FISAT 850
A-218 FISAT 875
SCMS
A-456 Rajagiri 923
A-111 SCMS 567
A-567 SCMS 765
A-432 ToCH 876
A-223 ToCH 765
Features of sparse indices:
 Occupies Lesser index size as compared to dense indices
 More access time and hence affects the performance.
 One Index per block is desirable as this can considerable reduce
time by bringing only one required block to memory

Multilevel Indices:
If a sparse matrix grows too large, we make an index of the existing
index as it itself is an ordered list. This enables the outer index to be kept at
main memory and perform binary search to find corresponding inner index,
which in turn can be searched to get the block.

Features of multilevel indices

 This decreases access time considerably.


 The complete outer index can be kept at memory even if we have a
huge database and thereby reduce transfer b/w memory and secondary
memory.
 This concept can be extended to any number of levels.

As stated already the design of a database design for indexed


sequential files are purely application specific, and a designer with clear
picture of the requirements and available resources can design a high
performance application.

References:

1. Fundamentals of Database Systems: Elmasri & Navathe, Pearson


Education Asia

2. Database System Concepts :Silberschatz, Korth & Sudarshan, McGraw


Hill Publications
Submitted By:
Amrith Krishna,
Roll No:5,
S5, CSE-A,
FISAT`

You might also like