Tutorials Courses Interview Prep (100 Q&A) AI Tools (50) Developer Tools (50) Tracks Pricing Plans Blog & Articles Contact Us
MySQL Tuning, Indexing & Concurrency 5-8 Years (Senior) Medium

What is the difference between Clustered Index and Secondary Index in InnoDB?

Real-World Scenario / Incident Description

An interviewer asks why secondary index lookups perform a secondary traversal back to the clustered index (Bookmark Lookup).

240 views • Updated 1 month ago

Clustered vs Secondary Index

  • Clustered Index: The physical table data rows are stored directly inside the leaf nodes of the Primary Key B+Tree.
  • Secondary Index: Leaf nodes store only the indexed column value and the Primary Key value (not a physical row pointer).
  • To retrieve non-indexed columns, MySQL must perform a Bookmark Lookup (reading secondary index -> extracting PK -> searching Clustered Index).
Related Concepts: #Clustered Index #Secondary Index #InnoDB Internals