SQLite EXPLAIN visualizer

SQLite turns each SQL statement into a small program for its virtual machine. Type a statement to see that program, with every jump drawn and every opcode linked to its explanation, and the query plan as a tree.

Sample database
The sample database's tables
CREATE TABLE artists (id INTEGER PRIMARY KEY, name TEXT NOT NULL, country TEXT);
CREATE TABLE albums (id INTEGER PRIMARY KEY, artist_id INTEGER NOT NULL REFERENCES artists(id), title TEXT NOT NULL, year INTEGER);
CREATE TABLE tracks (id INTEGER PRIMARY KEY, album_id INTEGER NOT NULL REFERENCES albums(id), name TEXT NOT NULL, ms INTEGER, bytes INTEGER, price REAL);
CREATE INDEX tracks_album ON tracks(album_id);
CREATE INDEX artists_name ON artists(name);
CREATE INDEX artists_lower ON artists(lower(name));
CREATE TABLE artists_archive (id INTEGER PRIMARY KEY, name TEXT NOT NULL, country TEXT);
CREATE TABLE genres (name TEXT PRIMARY KEY, description TEXT) WITHOUT ROWID;
CREATE TABLE notes (id INTEGER PRIMARY KEY, album_id INTEGER, body TEXT, cover BLOB);
CREATE TABLE playlists (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL UNIQUE, created TEXT DEFAULT CURRENT_TIMESTAMP);
CREATE TABLE playlist_tracks (playlist_id INTEGER NOT NULL REFERENCES playlists(id) ON DELETE CASCADE, track_id INTEGER NOT NULL REFERENCES tracks(id), position INTEGER, PRIMARY KEY (playlist_id, track_id)) WITHOUT ROWID;
CREATE TABLE sales (id INTEGER PRIMARY KEY, track_id INTEGER NOT NULL, quantity INTEGER NOT NULL CHECK (quantity > 0), unit_price REAL NOT NULL, total REAL GENERATED ALWAYS AS (quantity * unit_price) VIRTUAL) STRICT;
CREATE INDEX sales_big ON sales(track_id) WHERE quantity > 10;
CREATE INDEX tracks_minutes ON tracks(ms / 60000);
CREATE VIRTUAL TABLE lyrics USING fts3(track_id, body);
CREATE VIEW album_lengths AS SELECT a.title, sum(t.ms) AS ms FROM albums a JOIN tracks t ON t.album_id = a.id GROUP BY a.id;
CREATE TRIGGER tracks_touch AFTER UPDATE ON tracks BEGIN UPDATE albums SET year = year WHERE id = new.album_id; END;

SQLite 3.54.1, compiled to WebAssembly by sql.js, runs in this page. Your SQL and your file stay on your device. Foreign key enforcement is on, so its opcodes show.