0
0
DBMS Theoryknowledge~5 mins

Primary vs secondary indexes in DBMS Theory - Quick Revision & Key Differences

Choose your learning style9 modes available
Recall & Review
beginner
What is a primary index in a database?
A primary index is an index based on the primary key of a table. It uniquely identifies each record and is used to quickly locate data. It is usually automatically created when a primary key is defined.
Click to reveal answer
beginner
What is a secondary index in a database?
A secondary index is an index created on non-primary key columns. It helps speed up queries on those columns but does not enforce uniqueness or directly identify records.
Click to reveal answer
intermediate
How does a primary index differ from a secondary index?
A primary index is based on the primary key and uniquely identifies records, while a secondary index is based on other columns and may not be unique. Primary indexes are often clustered, meaning data is stored in the order of the index, but secondary indexes are usually non-clustered.
Click to reveal answer
beginner
Why are secondary indexes useful?
Secondary indexes allow faster searching and retrieval of data based on columns other than the primary key. They improve query performance when filtering or sorting by those columns.
Click to reveal answer
beginner
Can a table have multiple secondary indexes?
Yes, a table can have multiple secondary indexes on different columns to optimize various queries. However, each index adds some overhead for data updates.
Click to reveal answer
Which index uniquely identifies each record in a table?
AComposite index
BSecondary index
CPrimary index
DForeign key index
What is true about secondary indexes?
AThey are based on non-primary key columns
BThey are always unique
CThey store data in sorted order
DThey replace the primary index
Which of the following is a benefit of secondary indexes?
AEnforcing data uniqueness
BSpeeding up queries on non-primary key columns
CReducing storage space
DAutomatically updating primary keys
Can a table have more than one secondary index?
AYes, multiple secondary indexes can exist
BNo, only one secondary index is allowed
COnly if the table has no primary key
DOnly if the database is NoSQL
Which index type is usually clustered, storing data in index order?
AHash index
BSecondary index
CBitmap index
DPrimary index
Explain the main differences between primary and secondary indexes in a database.
Think about uniqueness and which columns the indexes are built on.
You got /5 concepts.
    Describe why secondary indexes are important and when you would use them.
    Consider queries that filter by columns other than the primary key.
    You got /4 concepts.