BTI Beyond The Interviews

Databases · 8 sections

Database Indexing

B-trees, index types, and the rules that determine whether your query uses an index.

Premium · preview 94 cards Updated 24 Oct 2026
Free to preview. The first 3 cards and the full outline are below — the rest of this sheet is part of the Backend, Databases & AI bundle.

What's inside

Preview — first 3 of 94 cards

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);

B-tree structure

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 vs non-clustered

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.