Add SQLite Query Explainer tool#299
Merged
Merged
Conversation
Runs SQL queries against a SQLite database via Pyodide (Python's sqlite3 in the browser) and annotates the output of both EXPLAIN QUERY PLAN and EXPLAIN with plain-English descriptions of what SQLite is doing. - "Load example database" builds 170k+ rows across five tables (with indexes, a WITHOUT ROWID table and a view) using loops with a fixed random seed, plus 22 example queries chosen to illustrate as many query plan patterns as possible: full scans, rowid lookups, covering indexes, nested-loop joins, temp b-tree sorts, MULTI-INDEX OR, automatic indexes, materialized vs co-routine CTEs, recursive CTEs, window functions and more - Or open your own SQLite database file (copied into the browser sandbox, never modified) - it starts by running a query against sqlite_master to show the schema - EXPLAIN QUERY PLAN renders as an annotated tree with badges, and consecutive loops are labeled with their nested-loop join role - EXPLAIN bytecode instructions cross-reference each other: jump targets are clickable links, jump-target rows show which instructions jump to them, loop bodies get depth bars, and hovering a register or cursor highlights everywhere else it is used Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vx3Jgd4JPLFsKLwT8BemnL
Queries run against the example database are stored in the URL hash (#sql=...). Opening a bookmarked URL automatically loads Pyodide, rebuilds the example database and runs the query; changing the hash (back/forward navigation or pasting a link) re-runs it in place. Queries against a user-opened database file clear the hash instead, since that file can't be restored from a URL. The example picker gains a placeholder entry and deselects itself when the SQL in the editor no longer matches the chosen example. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vx3Jgd4JPLFsKLwT8BemnL
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs SQL queries against a SQLite database via Pyodide (Python's sqlite3
in the browser) and annotates the output of both EXPLAIN QUERY PLAN and
EXPLAIN with plain-English descriptions of what SQLite is doing.
indexes, a WITHOUT ROWID table and a view) using loops with a fixed
random seed, plus 22 example queries chosen to illustrate as many
query plan patterns as possible: full scans, rowid lookups, covering
indexes, nested-loop joins, temp b-tree sorts, MULTI-INDEX OR,
automatic indexes, materialized vs co-routine CTEs, recursive CTEs,
window functions and more
sandbox, never modified) - it starts by running a query against
sqlite_master to show the schema
consecutive loops are labeled with their nested-loop join role
targets are clickable links, jump-target rows show which
instructions jump to them, loop bodies get depth bars, and hovering
a register or cursor highlights everywhere else it is used
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01Vx3Jgd4JPLFsKLwT8BemnL