See whether SQLite scans or uses an index.

Section: Inspect query plans

Explain a query plan

sql
sql
EXPLAIN QUERY PLAN
SELECT * FROM posts WHERE user_id = 42 ORDER BY created_at DESC LIMIT 10;
Explanation

High-signal first step when a query feels slower than expected.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Inspect query plans
Enable automatic EXPLAIN QUERY PLAN in shell
Show plans before each entered statement.
OpenIn sheettextsame section
Collect statistics with ANALYZE
Help the planner choose better indexes.
OpenIn sheetsqlsame section
Rebuild indexes
Recreate indexes when needed.
OpenIn sheetsqlsame section
Run PRAGMA optimize
Let SQLite perform lightweight maintenance.
OpenIn sheetsqlsame section
Create a basic index
Index a frequently filtered column.
OpenIn sheetsql1 tag match
Create a composite index
Index multiple columns in query order.
OpenIn sheetsql1 tag match