What is the purpose of indexing in a database?
Correct answer: To speedup data search. Indexing in a database speeds up data search.
Background: An index works like a book index, jumping straight to matching rows.
- To reduce table size: An index adds structures, so it does not shrink the table.
- Both A & B: Indexing speeds searching but does not shrink tables, so both is wrong.
- None of the above: Indexing speeds searches, so this is wrong.
Did you know? Indexes speed reads but slow writes slightly.
Memory trick: Index = book index: find the page fast, not by reading the book.