SQLAdvanced#indexes#performance

What is a covering index?

An index that contains every column a query needs, so the engine answers the query from the index alone without touching the table (an index-only scan).

Example
CREATE INDEX idx_cover ON orders(customer_id, order_date, total);
SELECT order_date, total FROM orders WHERE customer_id = 7; -- index-only

Related Questions

1
SQLAdvanced#indexes#performance

Why might an index not be used by a query?

Open
2
SQLIntermediate#subqueries

What is a subquery? Correlated vs non-correlated?

Open
3
SQLIntermediate#subqueries

Difference between IN, EXISTS and JOIN?

Open