Index
Think of the "index" pages at the back of a book. Without an index, to find the pages where the word "SQLite" appears you would have to flip through the whole book page by page, but with an index it tells you the page numbers right away, like "SQLite ... pp. 42, 87, 130."
A database index works the same way. It is a separate list, prepared in advance, of which rows hold the values of a specific column (e.g. user_id).
Downsides? Queries get faster, but whenever the original data is updated, deleted, or inserted, the index must be updated too, which costs write work and storage space
Summary
| Category | Details |
|---|---|
| Concept | A separate list, prepared in advance, of which rows hold a specific column's values (like a book's index) |
| Pros | Faster query performance |
| Cons | The index is also updated on every update/delete/insert → extra write work and storage usage |
Source: Codyssey-B1/B6-1
