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

SQL · Query Optimization

What is a covering index?

Hardsql-33
covering indexindexperformance

Question

What is a covering index?

Solution

A covering index holds every column the query needs, so the engine can often answer from the index alone without fetching the table row.

Example:

CREATE INDEX idx_customer
ON customers(email, name);

Query:

SELECT name
FROM customers
WHERE email = 'x@example.com';

The index contains both:

email
name

so a separate table lookup may not be required.

In short:

> Regular index → find the row, then visit the table. > Covering index → everything needed is already in the index.

🎯 Put this concept into practice

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

Open related drill →
PreviousNext