Software → Databases
Database Index
A data structure that speeds up data retrieval at the cost of additional storage and write work.
Where it fits
A database index is a data structure that helps a database find rows efficiently. It connects SQL, B-Trees, query planners, reads, writes, and storage trade-offs.
Mental model
An index is like a lookup structure maintained beside the table. It speeds up some reads but adds work to writes and consumes storage.
Example
An index on users.email lets the database find a user by email without scanning every row.
Common mistakes
- Adding indexes without understanding query patterns.
- Forgetting that indexes slow down writes.
- Assuming every query can use every index.
Related concepts
B-Tree, query planner, SQL, relational database, LSM-Tree.