Primary index in sequential order file organisation is also known as ______.
sparse index
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.
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.
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.
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 |
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.
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.
| 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. |
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.
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.
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
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)
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?

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?