A index is a special database table that can be used to speed up database queries.
Think of it like a table of contents. The database index lets you jump straight to the data you're looking for instead of scanning through every row.
Indices aren't free: storing the index takes space, and every time the database is updated the index has to be updated to match.
Consider adding an index if you have fields that are frequently used in database lookups, especially if the database is mostly read and rarely updated.
Interview coming up?
Get the free 7-day email crash course. You'll learn how to think algorithmically, so you can break down tricky coding interview questions.
No prior computer science training necessary—we'll get you up to speed quickly, skipping all the overly academic stuff.
No spam. One-click unsubscribe whenever.
You're in! Head over to your email inbox right now to read day one!
Interview Cake