MySQL & InnoDB (50 Qs)•Part 2: Core Architecture & Implementation (Mid-Level)
What is a Covering Index and why is it faster?
senior LevelMost AskedSystem Design
In Simple Words: A covering index is an index that contains all the columns requested by the query:
- Example: Index on
(status, created_at, user_id). - Query:
SELECT user_id, created_at FROM orders WHERE status = 'pending'; - Performance Gain: MySQL satisfies the entire query directly from the secondary index leaf nodes. It skips the clustered index table lookup entirely, cutting disk I/O in half!
EXPLAINreportsExtra: Using index.