UNDERSTAND HOW SQLITE FINDS ROWS

SQLite query plan explorer

Open a database, select a single SELECT query and click Explain beside Run query. Read the plan hierarchy, original SQLite detail and plain-language explanations. Your query and database stay in your browser.

Compare before and after an index

  1. Open the lesson and run the setup once.
  2. Select only the SELECT statement and click Explain. Choose Keep as baseline.
  3. Close the plan. Uncomment, select and run the CREATE INDEX statement.
  4. Select the same SELECT again and click Explain. Compare the current plan with the saved baseline.

Read the important operations

SCAN means visiting a table or index broadly. SEARCH means narrowing rows using a key or index. USE TEMP B-TREE identifies temporary work for sorting, grouping or duplicate removal. A covering index can supply all requested columns without a separate table lookup.

SELECT id, amount FROM plan_demo WHERE category = 'rare';

The lesson returns 50 of 1,000 rows. Expect a table scan before the index and an index search afterward. Plans can vary with SQLite version, statistics and schema.

What a plan cannot tell you

Explain prepares a read-only statement; it does not execute the selected query or measure its runtime. A scan is not automatically bad. Indexes consume space and increase write work. Measure representative queries and data before deciding to keep an index.

The explorer accepts one read-only SELECT or WITH query without parameters. Select a query inside a larger script. Plans are bounded to 1,000 nodes and 1 MiB; the comparison baseline stays in memory and clears when the database changes.

Index design guide · Runnable index example · Official EXPLAIN QUERY PLAN documentation