I rebuilt the query plan viewer from scratch

SQLly's query plan pane now reads like a diagnosis: a plain-English story, 42 ranked checks with the SQL to fix them, a real diagram, and a free online viewer.

By

Query plans are where a slow query tells you what's wrong with it, and almost nobody reads them because they look like a stack trace from 1997. I rebuilt SQLly's plan tooling from the parser up so a plan reads like a diagnosis. The same engine also runs free in your browser, no install needed.

The old plan pane wasn't good enough

SQLly has had a plan pane for a while. You pressed ⌘L, got an operator tree, a diagram, and a short list of warnings like "Table scan" or "Missing index". The docs page for it had a "work in progress" badge, and that was honest. It read the plans SQLly captured itself on eight engines, and choked on most plans you copied out of anything else.

The warnings were the real problem. "Table scan on orders" isn't advice. Is the table 200 rows or 200 million? Did the scan cost 2% of the query or 90%? Is there already an index the optimizer ignored, and if so, why? A DBA sitting next to you would answer those questions before saying anything. The pane didn't.

So I threw most of it out and started over with one goal: when you open a plan, you should know what to fix, why, and what to type, without needing to know what a Hash Match (Aggregate) is.

The story first

The pane now opens on a Summary instead of a tree. The first line says what the query did: "This query read from customers, orders, order_items and products and returned 20 rows in 467 ms." Then the step that cost the most, with its share and how many rows it read to return how many. Then every operator as a numbered step in the order the work actually happens, in plain English: "Scans orders and returns 270K rows. Keeps only rows where status <> 'new', which discards 130K rows."

SQLly's plan pane Summary: a one-line description of the query, the bottleneck step, numbered steps on the left and ranked findings on the right
The Summary for a PostgreSQL report query: what it did, the bottleneck, every step in order, and the findings ranked on the right.

It sounds small. It isn't. Most of the time I spent staring at plans was spent translating them in my head, and that translation is now done for you, from the same numbers.

Findings that name the cause and the fix

The findings got the biggest rewrite. There are now 42 checks, and each finding is written about your plan, with your tables and your numbers: what happened, why it costs time, what to do about it, and the statement that does it, written for your engine.

An expanded plan finding in SQLly showing the explanation, an ANALYZE statement with Copy SQL and Open in new tab buttons, the evidence from the plan and Learn more links
A row estimate off by 10,000×: why it matters, the statement to run, the evidence, and links to longer guides.

A few things I cared about a lot here:

  • Ranked by what fixing it would save. Each finding shows its share of the run time, and the list is sorted by it. The first thing on the list is the first thing to fix.
  • Quiet when it should be. Every check needs both a real size and a real share of the query. A scan of a 20-row lookup table isn't reported. "Critical" only shows up when the statement actually ran long, so a fast query never gets a red badge.
  • Real SQL. CREATE INDEX with the right key order and INCLUDE columns on SQL Server and PostgreSQL, covering columns appended as keys on MySQL and Oracle, an expression index for lower(email), ANALYZE or UPDATE STATISTICS, a work_mem value sized from the actual spill. An index suggestion also says what it'll cost you on writes.
  • No duplicates. If two findings want the same index, you get one statement. A wider index absorbs a narrower one, and SQL Server's own missing-index hint replaces the generic scan warning instead of stacking on top of it.
  • Confidence. Each finding says how sure it is. Some things the plan proves (a sort spilled 6 MB to disk). Some it only suggests (this estimate is probably wrong because two filter columns are correlated). You should know which is which.

The checks cover the usual suspects (missing indexes, key lookups, stale statistics, implicit conversions, functions on filtered columns, spills, oversized memory grants) and a bunch that are easy to miss: parameter sniffing, row goals from TOP or EXISTS, hash joins built on the larger input, nested loops over way too many rows, joins that multiply rows, subqueries run once per row, CTEs filtered after they're materialized, partitions that weren't pruned, parallel skew, and PostgreSQL JIT that took longer than the query. The findings docs have the whole list.

Each finding also links to a longer guide in the SQL performance section of this site, like estimated rows far from actual rows or sorts and hashes that spill to disk. The finding tells you what to do; the guide explains why, for when you want to actually understand it.

It checks the advice against your schema

A plan tells you what the database did. It doesn't tell you what indexes it passed over, or that the two columns in your join have different types. So when SQLly knows your tables (it already does for IntelliSense on a connected database), the findings use them. It won't suggest an index you already have. It'll extend an existing one instead of adding a near-copy. And it adds checks only the schema can answer: an index the plan ignored and the likely reason, a foreign key with no index, a join on mismatched types or collations, NOT IN over a nullable column, and a heap with no clustered index.

A diagram you can actually read

SQLly's plan diagram with operator cards coloured by time, a parallel section outlined, the bottleneck card marked, a minimap and the selected operator's details
The Diagram, coloured by time, with the bottleneck selected and its details on the right.

Each operator is a card with its table, rows and share of the time. You can colour the cards by time, cost, rows, estimate error or page reads. Connectors get thicker where more rows flow, the heaviest path is marked, parallel sections are outlined, and the heaviest operators carry a text badge so colour isn't the only signal. Flip it top-down or left-to-right, fold branches, search for a table, walk it with the arrow keys, and use the minimap when the plan has 300 operators. Click a card and the details panel tells you what that operator did here and what that kind of operator is, from a glossary of about 700 operators across ten engines.

There's also an Operators table (sortable, copyable, same grid as your results) and a Time view with an icicle chart and totals by operator, by kind of work and by table. That last one is surprisingly useful. "64% of the time was index seeks" is obvious once it's added up, and invisible when it's spread over four operators.

SQLly's plan Time view: an icicle chart of the operator tree above breakdowns of time by operator, by kind of work and by table
The Time view: where the 567 ms went, by operator, by kind of work and by table.

Before and after, in sentences

Tuning is a loop. Capture, change something, capture again, check it helped. The pane keeps your last eight captures in each tab, and Compare explains the difference as a list of sentences marked better, worse or changed, instead of making you eyeball two diagrams.

SQLly comparing two captures: the new plan ran 190 times faster, the cost estimate dropped 179 times, both tables are now read through indexes and the row estimate is close
A lookup query before and after two indexes: 190 times faster, and why.

It also gets the annoying cases right. A table the new plan reaches through an index (a PostgreSQL Bitmap Heap Scan, an Oracle TABLE ACCESS BY INDEX ROWID) is reported as a different access path, not as a table that vanished. Compare an estimated plan with an executed one and it tells you only costs, estimates and shape can be compared.

Eleven engines, and plans from anywhere

Plans now open from SQL Server, PostgreSQL, MySQL, MariaDB, SQLite, DuckDB, ClickHouse, Oracle, CockroachDB, Trino and Spark SQL, in 23 formats. That means the output those engines actually print, not only what SQLly captures itself: .sqlplan files, PostgreSQL text with psql or pgAdmin borders, YAML and XML, MySQL's \G output and TREE format, Oracle DBMS_XPLAN with ALLSTATS LAST, DuckDB's box drawing, and so on.

You can paste a plan straight out of a terminal, a chat or a ticket. Shell prompts, Markdown code fences, line numbers and log prefixes get stripped, and the format is recognised from the text. If it can't be read, it tells you what it looks like ("this is SQLite bytecode, not a plan") and what to run instead. That one came from me pasting EXPLAIN instead of EXPLAIN QUERY PLAN into my own tool more times than I'd like to admit.

Free in your browser

The whole plan engine also compiles to WebAssembly, so the online query plan viewer on this site runs the same parser, summary and findings as the app. Paste a plan and you get the story, the ranked fixes, the diagram, the icicle chart and the breakdowns. You can paste table definitions so the advice is checked against your schema, and paste a second plan to compare.

The free online query plan viewer on sqlly.app showing four ranked findings with SQL, evidence and Learn more links
The online viewer's What to fix section, from one of its 19 sample plans.

Nothing is uploaded. Plans carry your SQL, table names and sometimes parameter values, and I don't want them. The analysis runs in your tab, and a share link puts the plan in the part of the URL after the #, which browsers never send to the server. There are 19 sample plans if you just want to poke at it.

How much plan fits in a link

Putting the whole plan in the link has one catch: links have length limits, and they're not where you'd expect. So the viewer compresses the hell out of the plan first. It runs Brotli at its highest setting, then base64url-encodes the bytes so the link survives being pasted anywhere. A 31 KB SQL Server plan turns into a 4,900-character link, about 6.5× smaller. I also tried gzip, zstd and xz on the same plans. Brotli beat all of them, and came out 15 to 30% smaller than gzip.

Browsers take long links fine. Chat apps don't. Roughly:

  • Chrome and Edge: 2 MB (2,097,152 characters). Past that they won't open the link at all. The address bar stops displaying around 32,000 characters, but the link still works.
  • Firefox: 1 MB by default.
  • Safari: no fixed limit. You'll run out of patience first.
  • Slack: 40,000 characters per message.
  • Microsoft Teams: about 28 KB per message, and formatting counts against that.
  • Discord: 2,000 characters per message, 4,000 with Nitro.
  • Email: no hard limit, but past about 2,000 characters some mail clients wrap or rewrite a link and break it.

Server limits don't matter here. A long URL usually dies on the server with a 414 error, but the part after the # never gets sent to a server, so the only limits are the browser's and whatever app you paste the link into.

You don't have to remember any of that. Press Copy share link and the viewer shows how long the link is, with a check mark, a warning or a cross for each of those places. If the plan is too big for any browser (a link over 2 MB, or more than 8 MB of plan before compression), it says so and copies nothing. Send the file instead.

The online query plan viewer after Copy share link: a 4.8 KB link for a 31 KB plan, with check marks for Chrome, Edge, Firefox, Safari, Slack and Microsoft Teams, a cross for Discord and a warning for email
After you copy a share link: how long it is, and where it will paste.

Yes, the free tool is partly marketing. It's also genuinely useful on its own, and I'd rather you find SQLly because it helped you fix a slow query than because of an ad.

What's still rough

  • Findings are rules, not magic. They're written from what the plan shows, and they can be wrong. That's why each one shows its evidence and how confident it is. If one is wrong for your plan, please tell me.
  • No Snowflake or BigQuery plans. ClickHouse, SQLite and libSQL only have estimated plans here, because that's what those engines give you.
  • The online viewer is English only. The app is translated into ten languages, but some row-count sentences in Russian and French can come out ungrammatical, since the translation system has no plural forms yet.
  • Tiny queries don't have useful timings. When a statement is too fast for per-step times to mean anything, the plan says so and ranks steps by cost or rows instead of pretending.

Try it

The rebuilt plan pane ships in SQLly 1.42, and it's in notebook Plan cells too. If you don't want to install anything, the online viewer is free and has no sign-up. Paste the plan that's been bugging you and see what it says. The query plan docs go through every view, finding and format in detail.

And if it gets your plan wrong, I want to know. Use Send Feedback in the app and tell me what it said and what it should have said. That's how it gets better.