Indexing & File Organization
An index is a separate structure, usually sorted, that lets the database find rows without reading the whole table. Interviewers ask about it because the B+ tree (a balanced, many-branched search tree), clustered versus secondary indexes, and the order of columns in a multi-column index decide whether a query takes milliseconds or minutes. After this section you can explain how a B+ tree lookup works and why it stays shallow, say what an index costs, choose the column order of a composite index, and compare B+ tree and hash indexes.
Topics in this section
- What an index is and what it costs
- B+ tree
- Range queries and which searches an index helps
- Clustered and secondary indexes
- Composite (multi-column) indexes
- Hash index and hashing
- How rows are stored: file organization