Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. What is an index?

SQL · Query Optimization

What is an index?

Hardsql-32
indexperformance

Question

What is an index?

Solution

An index is a data structure that helps the database find rows faster without scanning the entire table.

Imagine:

Book → index → page

Instead of reading every page, you look in the index.

Example:

CREATE INDEX idx_customer_email
ON customers(email);

Now searches on email may be faster.

Downsides:

  • Extra storage
  • Slower INSERT/UPDATE/DELETE
  • Maintenance overhead
  • Too many indexes can hurt write performance

🎯 Put this concept into practice

Solidify this answer with real hands-on interview drills in the browser studio.

Open related drill →
PreviousNext