Skip to content
  • Indexing · DBMS

Indexing

LearnViaNotes @learnvianotes· 1 min read

Indexing is an essential data structure technique designed to speed up search operations by reducing the number of physical disk block accesses required to retrieve rows.

Indexing Classifications

Index TypeKey Order AlignmentIndex densityDescription
Primary IndexOrdered key matches table structure.Usually SparseDefined on the primary key of an ordered data file. Only one primary index can exist.
Clustering IndexNon-key field ordered matches table.SparseDefined on a non-key ordered field (e.g., grouping employees by Department ID).
Secondary IndexTable physical order is independent of index key.DenseDefined on unordered fields (e.g., creating an index on email field). Multiple secondary indexes are allowed.

Index Dense vs Sparse

B-Tree vs B+ Tree Node Layout

Database engines use B+ Trees for relational indexes due to their physical layout advantages:

FeatureB-TreeB+ Tree
Data pointersStored in both leaf and non-leaf nodes.Stored only in leaf nodes. Non-leaf nodes only store search key values to route queries.
Leaf linkingLeaf nodes are not linked together.Leaf nodes are connected sequentially in a doubly linked list.
Range QueriesSlow. Requires executing in-order traversal (up and down the tree).Fast. Locate the starting key in a leaf, then traverse the linked list.
Internal Node capacityLow, because data pointers occupy space in internal nodes.High. Can store many child pointers, leading to a much wider fan-out and shorter tree.

Free for students and teachers

Write notes like this one

Cards for every idea, quizzes and flashcards, read aloud — on the web and your phone.

Something wrong with this note? Open it to report