Skip to content

SQL guides

Learn how to read query plans and choose indexes with worked SQLite examples. Compare the returned rows and database work before and after each change.

Start with the tuning workflow, then read the guides on plans and indexes.

  1. 1. 3 minute read

    A repeatable way to tune SQL queries

    Use a repeatable workflow to check results, read a plan, and verify an improvement.

  2. 2. 3 minute read

    How to read a query execution plan

    Recognize scans, searches, and sorts in a SQLite query plan.

  3. 3. 3 minute read

    How SQL indexes reduce query work

    Choose index columns based on the query and the share of rows its filter matches.

  4. 4. 3 minute read

    What a covering index does

    See when an index can answer a query without visiting the table.

  5. 5. 3 minute read

    How to use SQLite EXPLAIN QUERY PLAN

    Connect EXPLAIN QUERY PLAN output to the work a query asks SQLite to do.

  6. 6. 5 minute read

    What the N+1 query problem is and how to fix it

    Spot repeated application queries and compare them with a joined query.

Keep learning

Worked SQL examples walk through source rows, queries, and results.

How to use QueryPlan explains Run, Submit, hints, and saved progress.