// free tool

Query plan viewer

Paste an execution plan from SQL Server, PostgreSQL, MySQL, MariaDB, SQLite, DuckDB, ClickHouse or Oracle and see what is slow, why, and what to change - ranked findings, an operator tree and a plan diagram. It is the plan reader from the SQLly desktop app compiled to WebAssembly, so it runs in your browser and your plan never leaves your device.

Loading the plan reader…

Tip: press Ctrl+Enter (⌘+Enter on a Mac) in the box to analyze. Files are read on this device with your browser’s file reader; nothing is uploaded.

What this execution plan viewer does

A query plan is the database’s answer to “how will you run this?” - which indexes it reads, how it joins, how many rows it expects at each step and where the cost goes. Plans are dense, and every engine writes them differently. This viewer reads them all into one model and leads with what matters: a ranked list of problems in plain language, each with the reason it hurts and a concrete next step.

  • Findings first. Full scans, missing indexes, implicit conversions, key lookups, spills, missing statistics, cross joins, row goals and row-estimate misses - worst first, with the operator they belong to and, for SQL Server’s missing-index suggestions, a ready-to-review CREATE INDEX statement.
  • Eight engines, one view. SQL Server, PostgreSQL, MySQL, MariaDB, SQLite, DuckDB, ClickHouse and Oracle plans read the same way, so you do not need a different tool per database.
  • Tree and diagram. The operator tree shows each step’s share of cost, estimated rows and actual rows side by side, with misses of 10× or more highlighted. The diagram lays the plan out top-down with cost bars you can scan at a glance.
  • Batches and pasted output. Multi-statement SQL Server plans get a statement switcher. Output copied from psql, the mysql client or sqlplus is unwrapped for you - no need to strip borders or + continuations first.
  • Private. The whole analysis runs in your tab. Plans carry your SQL, table names and sometimes parameter values; none of it is uploaded.

How to get an execution plan from each database

Every engine has two kinds of plan. An estimated plan is the optimizer’s prediction and never runs the statement. An actual plan runs the statement and records real row counts - the only way to see where the optimizer guessed wrong. Actual capture executes inserts, updates and deletes too, so test data changes inside a transaction you roll back.

SQL Server and Azure SQL: ShowPlan XML

Actual plan - runs the query and returns one plan document per statement, after the results:

SET STATISTICS XML ON;
SELECT ... ;   -- your query
SET STATISTICS XML OFF;

Estimated plan - compiles without running. SET SHOWPLAN_XML must be the only statement in its batch, hence the GO separators:

SET SHOWPLAN_XML ON;
GO
SELECT ... ;   -- your query
GO
SET SHOWPLAN_XML OFF;

In SSMS, turn on Include Actual Execution Plan (Ctrl+M) or use Display Estimated Execution Plan (Ctrl+L), then right-click the graphical plan and choose Save Execution Plan As… to get a .sqlplan file you can open here, or Show Execution Plan XML… to copy the XML. Plans already in the cache or in Query Store work too: sys.dm_exec_query_plan(plan_handle) returns the XML, and sys.query_store_plan.query_plan holds it as text. If you copy a large plan out of the SSMS results grid and the viewer reports incomplete XML, the grid truncated it (its XML limit is set under Tools > Options > Query Results > SQL Server > Results to Grid); save the plan as a file instead.

PostgreSQL: EXPLAIN (FORMAT JSON)

-- Actual plan: runs the query
EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) SELECT ... ;

-- Estimated plan: does not run it
EXPLAIN (FORMAT JSON) SELECT ... ;

-- Measure a data change without keeping it
BEGIN;
EXPLAIN (ANALYZE, FORMAT JSON) UPDATE ... ;
ROLLBACK;

The viewer reads the JSON format, not PostgreSQL’s default text output. Pasting straight from psql is fine - the QUERY PLAN header and the + at the end of each line are removed - or run psql -XqAt -c "EXPLAIN (ANALYZE, FORMAT JSON) ..." for clean output. For plans of queries your application ran, the auto_explain module can log them with auto_explain.log_format = json.

MySQL: EXPLAIN FORMAT=JSON and EXPLAIN ANALYZE

-- Estimated plan as JSON: does not run the query
EXPLAIN FORMAT=JSON SELECT ... ;

-- Actual plan (MySQL 8.0.18 and later): runs the query
EXPLAIN ANALYZE SELECT ... ;

Both are read, and the viewer tells them apart by shape. The mysql client’s table borders, \G row banners and “1 row in set” footers are stripped when you paste. Newer MySQL releases can also emit a second JSON layout (explain_json_format_version = 2); the viewer reads the original one, so run SET explain_json_format_version = 1; first if your server defaults to version 2.

MariaDB: EXPLAIN and ANALYZE FORMAT=JSON

-- Estimated plan: does not run the query
EXPLAIN FORMAT=JSON SELECT ... ;

-- Actual plan with r_rows, r_loops and timings: runs the query
ANALYZE FORMAT=JSON SELECT ... ;

SQLite: EXPLAIN QUERY PLAN

EXPLAIN QUERY PLAN SELECT ... ;

SQLite never runs the statement for EXPLAIN QUERY PLAN, and its plans carry no costs or row estimates - just the steps, which is still enough to spot a SCAN that should be a SEARCH. The sqlite3 shell’s tree (QUERY PLAN, |--, `--) is read as-is, and so are the raw id | parent | notused | detail rows other tools return. In the shell, .eqp on prints the plan before every statement you run.

DuckDB: EXPLAIN (FORMAT JSON)

-- Estimated plan
EXPLAIN (FORMAT JSON) SELECT ... ;

-- Actual plan with per-operator rows and timing: runs the query
EXPLAIN (ANALYZE, FORMAT JSON) SELECT ... ;

Paste the JSON from the explain_value column. DuckDB has no cost units, so an actual plan shades operators by the time they took.

ClickHouse: EXPLAIN json = 1

EXPLAIN json = 1, indexes = 1
SELECT ...
FORMAT TSVRaw;

indexes = 1 adds how many parts and granules each primary key, partition key and skip index kept; that is how the viewer spots a read that pruned nothing. FORMAT TSVRaw returns the JSON without escaping. ClickHouse has no EXPLAIN ANALYZE, so its plans are always estimated.

Oracle Database: DBMS_XPLAN

-- Estimated plan: does not run the query
EXPLAIN PLAN FOR SELECT ... ;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);

-- Actual plan: run the query with row-source statistics, then read its cursor
SET SERVEROUTPUT OFF
SET LINESIZE 300
SELECT /*+ GATHER_PLAN_STATISTICS */ ... ;
SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY_CURSOR(NULL, NULL, 'ALLSTATS LAST'));

Paste the whole output, including the Predicate Information section - the viewer attaches each access and filter predicate to its operation. DISPLAY_CURSOR needs SELECT access to V$SESSION, V$SQL, V$SQL_PLAN and V$SQL_PLAN_STATISTICS_ALL, granted directly to the user. Keep SERVEROUTPUT off in SQL*Plus or SQLcl, or the “last cursor” it shows is the output call rather than your query, and widen LINESIZE so the plan table does not wrap.

What each finding means and how to fix it

Findings are ranked by severity and then by the operator’s share of the statement’s cost, so the first card is usually the most expensive problem you can fix. Each one names the operator it came from - select it to jump there in the tree.

Missing index

What it means. While compiling the statement, SQL Server worked out an index that would have made it cheaper and recorded it in the plan with an estimated improvement. The viewer reports it once, on the operator that reads that table, and turns it into a CREATE NONCLUSTERED INDEX statement. Suggestions with an estimated impact of 90% or more are marked critical.

How to fix it. Treat the statement as a draft. The optimizer lists equality columns, then inequality columns, then included columns, without checking the indexes you already have - an existing index can often be widened instead of adding a near-duplicate, and every index slows down writes. Check that the key column order suits your other queries, then create it and capture the plan again. This finding comes from SQL Server plans only; other engines do not record index suggestions.

Full table scan

What it means. The operator reads every row of a table (or a whole index) to find the ones it needs. The viewer flags SQL Server table scans and index scans with a residual predicate, PostgreSQL Seq Scan, MySQL and MariaDB access_type: ALL and Table scan on, SQLite SCAN steps without an index, DuckDB scans with no pushed-down filter, ClickHouse reads whose indexes pruned no granules, and Oracle TABLE ACCESS FULL.

How to fix it. A scan is the right choice for small tables and for queries that need most of the rows. When the filter is selective, add an index on the filtered or joined columns, and make sure the predicate can use it: no function wrapped around the column (WHERE lower(email) = ... needs an expression index in PostgreSQL), no leading wildcard in LIKE '%x', and matching data types. In ClickHouse, filter on a prefix of the table’s ORDER BY key or add a skip index.

Row estimate miss

What it means. An actual plan read at least 10× more or fewer rows than the optimizer estimated for that operator. Every later choice - join type, join order, memory grant - was made for the wrong amount of data, so a big miss low in the plan often explains a slow plan above it. The finding appears only when the plan has runtime statistics. In SQL Server plans the estimate is compared across all executions of the operator; PostgreSQL reports both numbers per loop.

How to fix it. Start with statistics: UPDATE STATISTICS on SQL Server, ANALYZE on PostgreSQL, ANALYZE TABLE on MySQL and MariaDB, DBMS_STATS.GATHER_TABLE_STATS on Oracle. If the numbers are still far off, the predicate is hard to estimate: correlated columns (PostgreSQL’s CREATE STATISTICS helps), a function on a column, or a local variable in T-SQL, which the optimizer cannot see the value of (OPTION (RECOMPILE) lets it).

Implicit conversion blocks a seek

What it means. SQL Server had to convert a column’s values to another type before comparing them, so it could not seek an index on that column and scanned it instead. The classic cause is an nvarchar parameter compared with a varchar column. The viewer reports SQL Server’s “Seek Plan” conversion warnings; conversions that only affect cardinality estimates are listed separately as optimizer warnings.

How to fix it. Make the compared value the column’s type: declare the parameter as varchar, set the parameter’s type and length explicitly in your data-access code instead of letting it infer one from a string, or change the column if it really should be Unicode.

Key lookup

What it means. SQL Server found the rows through a nonclustered index, then went back to the table once per row for columns the index does not contain (a Key Lookup, or a RID Lookup on a heap). Cheap for a handful of rows, expensive for thousands, because each lookup is a separate read.

How to fix it. If it runs for many rows, add the missing columns to the index’s INCLUDE list so it covers the query, or select fewer columns. For a few rows it is usually fine - the plan marks it as information, not a warning.

Spill to tempdb

What it means. A sort or hash operator ran out of the memory SQL Server granted the query and wrote intermediate rows to tempdb, which is much slower than working in memory. It is usually a symptom of a low row estimate: the grant was sized for fewer rows than arrived.

How to fix it. Fix the estimate first (see row estimate miss), cut the rows reaching the operator with a more selective filter, or drop an unnecessary ORDER BY or DISTINCT. Newer SQL Server versions adjust memory grants between executions on their own (memory grant feedback); the MIN_GRANT_PERCENT query hint is the manual lever.

Columns with no statistics

What it means. SQL Server had no statistics on a column the query filters or joins on, so its row estimates there are guesses.

How to fix it. Make sure AUTO_CREATE_STATISTICS is on for the database, or create statistics on the named columns with CREATE STATISTICS.

No join predicate

What it means. A join has no condition relating the two inputs, so every row on one side pairs with every row on the other: two 1,000-row tables become a million rows before any filter runs. It is almost always a missing or mistyped ON clause.

How to fix it. Add the join condition. If you really want every combination, write CROSS JOIN so the intent is clear.

Row goal

What it means. TOP, EXISTS, IN or OPTION (FAST n) told SQL Server it only needs the first few rows, so it chose a plan that starts returning quickly - often nested loops over an index - even if it costs more to run to completion.

How to fix it. Usually nothing: that is the plan you want for a top-N query. If the query ends up reading far more rows than the goal assumed, the row goal is the reason the plan looks the way it does; SQL Server 2016 SP1 and later accept OPTION (USE HINT('DISABLE_OPTIMIZER_ROWGOAL')) to compare against the plan without it.

Spool

What it means. SQL Server stored intermediate rows in a worktable (a Table Spool or Index Spool) to reuse them. That is often a sensible optimization, but an eager index spool means the optimizer is building a temporary index on every execution because a permanent one is missing.

How to fix it. Leave it alone unless the spool carries a large share of the cost. For an index spool, create the index it is building - its seek columns show which.

Other optimizer warnings

What it means. Warnings the engine recorded that do not fit a category above, shown with the engine’s own wording - for example SQL Server’s excessive memory grant warning (the query reserved far more memory than it used, which starves concurrent queries) or a type conversion that may affect cardinality estimates.

How to fix it. Read the operator’s details. Excessive grants usually come from overestimated rows or wide varchar(max) columns being sorted; conversions are fixed the same way as the implicit conversion finding.

Reading the tree and the diagram

  • Data flows up. The root operator - the one that returns rows to you - is at the top. Its children feed it rows, so the leaves at the bottom are where data is read from tables and indexes.
  • Cost share. The percentage is the operator’s estimated subtree cost against the whole statement, the same figure SQL Server, PostgreSQL, MySQL and Oracle report. Costs are optimizer units, not milliseconds, and include everything below the operator; DuckDB plans use time instead and SQLite and ClickHouse plans have no costs at all.
  • Estimated → actual. On an actual plan each operator shows what the optimizer expected and what really happened. A miss of 10× or more is highlighted, because that is where plans go wrong.
  • Amber bars. In the diagram the bar under an operator tracks its cost share and turns amber when that operator has a warning.

The web viewer and the SQLly desktop app

This page and the plan pane in SQLly share the same parser and findings engine. The desktop app adds everything that needs a live connection.

FeatureWeb viewerSQLly desktop
Findings, operator tree and diagramYesYes
Open or paste a saved planYesYes
Capture actual or estimated plans with one shortcut-Yes, from the editor
EXPLAIN options (ANALYZE, BUFFERS, VERBOSE…) remembered per connection-Yes
Profile preset that only executes SELECT statements-Yes
Compare two captures of the same query-Yes
Open a suggested index in a new query tabCopy onlyYes
AI walkthrough of the plan-Yes

Query plan viewer FAQ

Is this query plan viewer free?

Yes. There is no sign-up and no limit on how many plans you open. It is the plan reader from the SQLly desktop app, published as a free web tool.

Is my execution plan uploaded anywhere?

No. The viewer is compiled to WebAssembly and runs inside your browser tab. A plan you paste or open is read on your device; it is never sent to a server, logged or stored. Plans contain your SQL text, table names and sometimes parameter values, so this matters.

Which plan formats can it read?

SQL Server ShowPlan XML (.sqlplan files, SET STATISTICS XML and SET SHOWPLAN_XML output), PostgreSQL EXPLAIN (FORMAT JSON) with or without ANALYZE, MySQL EXPLAIN FORMAT=JSON and EXPLAIN ANALYZE, MariaDB EXPLAIN FORMAT=JSON and ANALYZE FORMAT=JSON, SQLite EXPLAIN QUERY PLAN, DuckDB EXPLAIN (FORMAT JSON), ClickHouse EXPLAIN json = 1 and Oracle DBMS_XPLAN output. The format is detected automatically.

Does capturing an actual plan run my query?

Yes. SET STATISTICS XML, EXPLAIN ANALYZE, ANALYZE FORMAT=JSON and GATHER_PLAN_STATISTICS all execute the statement, including any INSERT, UPDATE or DELETE. Use the estimated form (SET SHOWPLAN_XML, EXPLAIN without ANALYZE, EXPLAIN PLAN FOR) when the statement must not run, or wrap a data change in a transaction you roll back.

Why can it not read my PostgreSQL plan?

The viewer reads PostgreSQL’s JSON plan format, not the default text format. Run EXPLAIN (FORMAT JSON) or EXPLAIN (ANALYZE, FORMAT JSON) and paste the result. Output copied straight from psql, including its QUERY PLAN header and the + at the end of each line, is cleaned up automatically.

Why are costs or row counts missing for some engines?

The viewer only shows what the engine reports. SQLite’s EXPLAIN QUERY PLAN has no costs or row estimates, ClickHouse has no cost model, and DuckDB has no cost units, so those plans show the operator structure and the scans rather than cost shares. Actual row counts appear only for plans captured with runtime statistics.

Can I compare two execution plans?

Not in the web viewer. The SQLly desktop app keeps a history of the plans you capture in each query tab and compares any two of them, calling out operators that regressed, improved, appeared or disappeared.

// skip the copy and paste

Capture, read and compare plans where you write SQL

SQLly is a native SQL workbench for macOS, Windows and Linux. Press Explain in the editor to capture an actual or estimated plan, read the same findings as this page, and compare two runs to prove a tuning change worked.