All Exams Test series for 1 year @ ₹349 only
Question

Primary index in sequential order file organisation is also known as ______.

The correct answer is

sparse index

Understanding Primary Indexes in Sequential File Organization

In database systems, files containing data records are organized in various ways. One common method is sequential order file organization, where records are stored one after another based on the value of a primary key. To efficiently retrieve records from such a file, indexes are used. A primary index is a special type of index built on the primary key of the file.

Primary Index in Sequential Files

When a primary index is used with a file that is sequentially ordered on the primary key, the index does not need an entry for every single record in the data file. This is because the data records are already sorted according to the primary key.

Instead of pointing to every record, a primary index typically contains entries for blocks of records in the data file. Each index entry points to the first record in a specific data block. This structure helps in quickly locating the block containing the desired record, and then the system can sequentially scan that block to find the exact record.

Why it's called a Sparse Index

An index that does not have an entry for every search key value or every record in the data file is known as a sparse index. Since the primary index in a sequentially ordered file typically only has entries for blocks (or some other non-every-record granularity), it fits the definition of a sparse index. It is 'sparse' because there are fewer index entries than data records.

In contrast, a dense index has an index entry for every search key value (or every record). This is common for secondary indexes or primary indexes on files that are not sequentially ordered on the primary key, but it is not the standard structure for a primary index on a sequential file.

Comparing Sparse and Dense Indexes

Let's look at the key differences:

Feature Sparse Index Dense Index
Entries per Record Fewer entries than data records (e.g., one entry per block) Entry for every search key value/record
Size Smaller Larger
Lookup Speed Requires sequential scan within a block after finding the block Can often point directly to the record or block containing the record
เหมาะสมกับการใช้งาน Primary index on sequential files Secondary indexes, primary index on non-sequential files

Other Index Types (Briefly)

  • Clustering Index: An index where the order of records in the data file is the same as the order of the search key values in the index. A primary index on a sequentially ordered file is a type of clustering index because the data file is physically ordered by the primary key.
  • Non-Clustering Index: An index where the order of records in the data file is different from the order of search key values in the index. Secondary indexes are typically non-clustering.

While a primary index on a sequential file is also a clustering index, the term that describes its structure (specifically, the number of entries relative to records) is 'sparse'. Therefore, in the context of its structure in sequential file organization, it is known as a sparse index.

Conclusion

The primary index used in sequential order file organization is characterized by having fewer index entries than data records, typically one entry per data block. This structural property defines it as a sparse index.

Revision Table: Key Concepts

Concept Description
Primary Index Index built on the primary key of a file.
Sequential File Organization Data records ordered physically by the primary key.
Sparse Index Index with fewer entries than records, typically pointing to blocks.
Dense Index Index with an entry for every record or search key value.

Additional Information: Indexing Techniques

Indexing is crucial for improving the performance of database queries. Different types of indexes and their implementation strategies are used depending on the file organization and query patterns.

  • Single-Level Index: The index file is a single level. Both dense and sparse indexes can be single-level.
  • Multi-Level Index: When the index file itself becomes too large, a hierarchical index structure can be created on top of the primary index. This forms a tree-like structure (like B+ trees), which are very common in modern database systems.
  • Secondary Indexes: Indexes built on attributes other than the primary key. These are almost always dense indexes.

Understanding the relationship between file organization and index structure, like why a primary index in a sequential file is sparse, is fundamental to understanding database performance.

Was this answer helpful?

Important Questions from Indexing

  1. A B-tree used as an index for a large database table has four levels including the root node. If a new key is inserted in this index, then maximum number of nodes that could be newly created in the process is

  2. The total cost of retrieving records in sorted order using an unclustered B+ tree is

    (P-Average number of records per data page

    N-Data pages

    F-Ratio of the size of a data entry to the size of a data record)

  3. In a relational database, a B+ Tree Index is to be constructed for a relation on a key field. In a B+ Tree, a Node Pointer points to a sub-tree and a Data Record Pointer points to a block of database records.

    Let, Node size = 4096 bytes, Node Pointer size = 10 bytes, Search Key Field size = 11 bytes and Data Record Pointer size = 12 bytes.

    The maximum number of Node Pointers that can be present in a non-leaf node of the B+ Tree is ________ . (Answer in integer)
  4. Consider a B+ Tree where the maximum number of key values in each leaf node is 2 and the maximum number of pointers in each non-leaf node is 3. Let the content of the B+ Tree be as shown in the figure.


    Which of the following options denotes the key value(s) stored in the root node after inserting a key value 3 in the given B+ Tree?

  5. An OTT company is maintaining a large disk-based relational database of different movies with the following schema: 

    Movie(ID, CustomerRating) 

    Genre(ID, Name) 

    Movie_Genre(MovieID, GenreID

    Consider the following SQL query on the relation database above: 

    SELECT * 

    FROM Movie, Genre, Movie_Genre 

    WHERE 

              Movie.CustomerRating > 3.4 AND 

              Genre.Name = “Comedy” AND 

              Movie_Genre.MovieID = Movie.ID AND 

              Movie_Genre.GenreID = Genre.ID; 

    This SQL query can be sped up using which of the following indexing options?

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App