Medium👤 3-5 years👤 8-15 years 1 min read

What is a database index and what is the trade-off?

Asked inAmazonDeloitte
Report issue

Coffee Chat Question

Concept Made Simple

What is a database index and what is the trade-off?

🧠Mind Map Answer

Remember It Faster

An index is like a book's index — instead of scanning every page (row), the DB jumps straight to the data.

Speeds upSELECT / WHERE / JOIN lookups
Slows downINSERT / UPDATE / DELETE (index upkeep)
CostsExtra storage

⌨️Hands-on Keyboard

Learn by Doing

sql
CREATE INDEX idx_users_email ON users(email);
-- now WHERE email = ? uses a B-tree seek, not a full scan

🔥What If?

Think Beyond the Expected

Why might the database ignore your index?

If a query returns a large fraction of the table, a full scan is cheaper than many random index seeks — so the optimizer skips the index. Low-selectivity columns rarely benefit.

Continue Learning with AI

Take this question deeper with your favourite AI assistant. Pick a depth, copy the prompt, or open it directly — AI is your learning companion, not a shortcut.

Plain-language foundations

I'm preparing for a software engineering interview and want to understand this from scratch, as a beginner.

Topic: Indexes (SQL)
Interview question: "What is a database index and what is the trade-off?"

Please:
1. Explain the core idea in simple, plain language, using an everyday analogy.
2. Define any technical terms you use.
3. Walk through one small, concrete example.
4. Finish with a single sentence I can easily remember.

Keep the tone friendly and assume I'm new to this topic.
Open inChatGPTGeminiClaude

Was this answer helpful?

Support our platform by exploring our recommended products.

As an Amazon affiliate, purchases through these links may earn us a small commission — at no extra cost to you. It helps keep Full Stack Interview Guru free.

Related Questions