The query never touches the table
A covering index includes every column the query needs — both in the WHERE clause and in the SELECT list. SQLite can satisfy the query entirely from the index B-tree without touching the main table at all. EXPLAIN QUERY PLAN reports this as USING COVERING INDEX.
Two ways to make an index 'cover' a query:
- Add the SELECTed columns to the composite index after the filtering ones.
- Use SQLite's index expressions to project derived values you frequently SELECT.
Warning: Wider indexes cost more in write overhead and disk space. Covering is a precision tool, not a default. Apply it to known-hot queries, not every query you write.