SQL Query Explainer
Most SQL is written quickly and read slowly — by a teammate, a reviewer, or you
three months later when the report comes back wrong. A query like
SELECT c.name, SUM(o.total) FROM orders o LEFT JOIN customers c ON c.id = o.customer_id
WHERE ... GROUP BY c.name is a small program: it pulls tables together, filters
rows, collapses groups and orders the survivors. This tool reads that program for you.
Paste any SQL statement — or several, separated by semicolons — and it explains
each one in plain English: what it selects, which tables join to which and on what
condition, which columns the WHERE clause touches, how rows are grouped,
ordered and limited. It then flags the performance patterns that most often turn a fast
query into a slow one: SELECT *, leading-wildcard LIKE
searches, functions wrapped around indexed columns, implicit comma joins that silently
become cartesian products, and UPDATE or DELETE statements with
no WHERE clause at all. It is deliberately honest about its limits: it reads
the text of your query, not your database, so every finding is a checklist to verify
with EXPLAIN — never a replacement for a real execution plan.
100% private. The parsing, the clause analysis and every finding are produced with JavaScript in this browser tab. Your SQL never leaves the page; there is no server-side calculation, no upload endpoint and nothing to send. Paste production queries with real table names and sensitive literals — they stay here.
1. Paste your SQL
One statement or a whole script block. Comments (-- and
/* */) are ignored, and statements separated by semicolons are analysed
one by one.
:: casts are non-sargable, MySQL TRUNCATE is DDL.
What you can paste
-- SELECT (the deep analysis: joins, filters, grouping, ordering)
SELECT o.id, c.name FROM orders o JOIN customers c ON c.id = o.customer_id WHERE o.status = 'paid';
-- INSERT (target table, columns, row count, column/value mismatch check)
INSERT INTO users (email, role) VALUES ('[email protected]', 'admin'), ('[email protected]', 'user');
-- UPDATE / DELETE (WHERE clause presence is the big one)
UPDATE orders SET status = 'shipped' WHERE id = 42;
DELETE FROM sessions WHERE expires_at < now();
-- CREATE TABLE (columns, primary key, foreign keys)
CREATE TABLE orders (id BIGINT PRIMARY KEY, user_id INT REFERENCES users(id), total NUMERIC(10, 2));
Other statement types (ALTER TABLE, DROP,
TRUNCATE, GRANT, ...) are summarised generically rather
than clause-by-clause.
2. Explanation & performance flags
Nothing analysed yet. Paste SQL above (or load the sample query) and the explanation appears automatically: a plain-English sentence for each clause, a table of every join with its condition, and each performance concern with its severity and fix.
How to use it
Step 1 — paste the statement or script. A single SELECT is the common case, but you can paste a whole migration or report block: every semicolon-separated statement gets its own explanation, structure table and concern list. Comments are stripped before parsing, so pasting straight from a code review or a ticket works as-is.
Step 2 — pick the dialect if you know it. "Any / auto" is fine for standard SQL. Choosing PostgreSQL, MySQL, SQL Server or SQLite adds engine-specific notes on top of the generic analysis — for example that SQL Server has no LIMIT (so an unbounded multi-table read is worth a TOP), that a PostgreSQL ::type cast in a predicate defeats plain indexes, and that MySQL's TRUNCATE cannot be rolled back.
Step 3 — read the explanation top to bottom. Each sentence corresponds to one clause of the query, with the relevant SQL fragment quoted. If you are learning SQL, this is the fastest way to see what a LEFT JOIN ... ON actually does compared with an INNER JOIN: the tool says it in words and shows the condition.
Step 4 — work through the concerns by severity. Red items are things that will damage data or multiply row counts (a DELETE with no WHERE, a cartesian product). Orange items are the classic slowdown patterns (leading-wildcard LIKE, functions on indexed columns, deep OFFSET pagination). Blue and green items are context worth knowing. Then confirm anything you plan to act on with EXPLAIN against the real database — this tool cannot see your indexes.
Step 5 — keep a record. "Copy full report" or "Download report" produces plain text with every statement, its explanation, structure and findings — handy for a code review comment, a support ticket, or documenting why a query was rewritten.
Worked example: the sample query
Click "Load sample query" and two statements are analysed. The first is a monthly revenue report:
SELECT c.name, COUNT(o.id) AS order_count, SUM(o.total) AS revenue
FROM orders o LEFT JOIN customers c ON c.id = o.customer_id
WHERE o.created_at >= '2026-01-01' AND UPPER(c.status) = 'ACTIVE'
GROUP BY c.name HAVING COUNT(o.id) > 5
ORDER BY revenue DESC LIMIT 50;
The explanation reads it back in words: it selects three expressions (a count and a sum, each with an alias), reads from orders and attaches customers with a LEFT JOIN on c.id = o.customer_id, keeps rows where the two WHERE predicates hold, groups by customer name, drops groups with five or fewer orders, orders by revenue descending and stops at 50 rows. The concern list raises one orange flag: UPPER(c.status) applies a function to a column inside the predicate, so an index on c.status alone cannot be used — the suggested fix is to store the status upper-case or to compare against the raw column.
The second statement is the legacy version of the same report, and it shows why this tool earns its keep: SELECT * (pulls every column), an implicit comma join between orders and customers that should be written as an explicit JOIN ... ON, and a leading-wildcard LIKE '%refunded%' that forces a full scan. None of these are syntax errors — the query runs fine on small data. All three show up as soon as the table grows, which is exactly the moment you want the warning.
How it works
The engine is a small SQL reader that runs entirely in your browser, in three passes:
- Tokenise and split. A character-level scanner understands single-quoted strings (including the
''escape), double-quoted and backtick identifiers, and both comment forms. Statements are split on semicolons that sit outside strings and parentheses, so a semicolon inside a string literal never breaks the analysis. - Model each statement. Clause boundaries (
FROM,WHERE,GROUP BY,HAVING,ORDER BY,LIMIT/OFFSET,UNION) are located at top level only, so subqueries and function calls inside a clause cannot be mistaken for new clauses. TheFROM section is parsed into tables with aliases, join types andON/USINGconditions; theWHEREtext is scanned for the columns each predicate touches. - Apply the rule set. About two dozen static patterns check the model: missing
WHEREonUPDATE/DELETE, cartesian risk from comma joins,SELECT *, leading-wildcardLIKE, functions or casts wrapped around columns in predicates,NOT INsubqueries with their NULL trap, deepOFFSETpagination, column/value count mismatches onINSERT, and a few dialect-specific notes. Each rule produces a finding with a severity, a plain-English explanation of why it matters, and a concrete fix.
The honest limitation: this is static text analysis. The engine never sees your schema, your indexes or your statistics, and it cannot tell what the optimiser will actually do. A query with no flags can still be slow (missing index), and a flagged pattern can be harmless on a 40-row table. Treat the output as a review checklist and let EXPLAIN / EXPLAIN ANALYZE make the final call.
Common mistakes this tool catches
DELETE/UPDATEwithoutWHERE. The most expensive "small" mistake in SQL: the statement touches every row. Flagged red, with the advice to select the same predicate first inside a transaction.NOT IN (SELECT ...)and NULLs. If the subquery returns even one NULL, the whole predicate matches nothing — a silent, hard-to-spot bug. The tool suggestsNOT EXISTS.- Leading-wildcard
LIKE '%...'. Cannot use a B-tree index; the engine scans the table. Suggests trailing wildcards or full-text search. - Functions on columns in
WHERE.UPPER(name) = 'X',DATE(created_at) = ..., casts — computed per row, so plain indexes go unused. - Implicit comma joins.
FROM a, b WHERE ...hides the join type; when theWHEREfails to link every pair of tables it becomes a cartesian product that multiplies row counts. Flagged with the explicit-JOINrewrite. - Deep
OFFSETpagination. Page 500 at 100 rows per page makes the engine fetch and discard 49,900 rows on every request; keyset pagination is suggested. INSERTcolumn/value mismatch. A column list of five with a six-value tuple lands data in the wrong columns (or is rejected); the counts are compared for you.ORDER BYon an expression. Sorting by a computed value cannot use an index on the underlying column.
Related tools
Suggested
Luke Keam | techgeek.biz