Back to the 2021 paper

Unit 3: Storage and Transaction Processing

20217m

What are the differences between primary index and secondary index?

Worked SolutionAI Assisted

Primary vs Secondary Index:

Primary Index: Ordered file on ordering key field (primary key or ordering field), sparse or dense, one per file, determines physical order (clustering). Example: File ordered by rollno, primary index on rollno. Has index entry per block. Cannot have many.

Secondary Index: On non-ordering field (any attribute), dense, may be many secondary indexes per file, does not determine file order, needs extra level (bucket for duplicates). Example: Index on name or department where file not ordered by that. Secondary is non-clustering, requires more entries.

Differences: Primary is on ordered key, reflects block anchors, sparse, clustering; Secondary is on non-ordered, dense, non-clustering, allows duplicates via buckets. Primary has unique entries per block, secondary may have many entries per value.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.