What is an index?
A separate data structure (usually a B-tree) that maps column values to row locations, speeding up lookups at the cost of extra storage and slower writes.
CREATE INDEX idx_users_email ON users(email);
Databases · 8 sections
B-trees, index types, and the rules that determine whether your query uses an index.
A separate data structure (usually a B-tree) that maps column values to row locations, speeding up lookups at the cost of extra storage and slower writes.
CREATE INDEX idx_users_email ON users(email);
Balanced tree with sorted keys and pointers. Lookup/insert/delete are O(log n). Supports equality, range, prefix, and ORDER BY. Default index type in most RDBMS.
EXPLAIN SELECT * FROM users WHERE id = 42;
Clustered index determines physical row order (one per table; often PK). Non-clustered stores key + pointer to row. InnoDB PK is clustered; secondary indexes point to PK.
PRIMARY KEY (id) -- clustered in InnoDB
91 more cards in this sheet
Unlock the Backend, Databases & AI bundle — ₹399
One-time payment. Unlocks this sheet and 14 other sheets in the bundle, plus a typeset PDF of each.
Unlock the bundle See all bundles
Or get all 76 sheets for ₹999 — one payment, every future sheet included.
What's new and the interview questions people are actually getting asked. No spam.