> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-worktree-statusbar-redesign.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# EXPLAIN Visualization

> View query execution plans as diagrams, trees, or raw output

# EXPLAIN Visualization

Click **Explain** in the query editor toolbar to get the execution plan.

PostgreSQL shows a dropdown with **EXPLAIN** (estimated plan) and **EXPLAIN ANALYZE** (runs the query and shows actual timing). MySQL, MariaDB, SQLite, and other databases show a single Explain button.

Typing an `EXPLAIN`, `EXPLAIN ANALYZE`, `EXPLAIN FORMAT=JSON`, or MariaDB's `ANALYZE FORMAT=JSON` statement in the editor and running it opens the same plan viewer, as long as the plan comes back in a single column. Multi-column plans like MySQL's plain `EXPLAIN` table stay in the results grid.

<Frame caption="EXPLAIN diagram view">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-worktree-statusbar-redesign/xcu3ZBKeDU3Zr2SM/images/explain-diagram.png?fit=max&auto=format&n=xcu3ZBKeDU3Zr2SM&q=85&s=c3dbaf89ec7e9641f3a838a505cc1b6e" alt="EXPLAIN diagram view" width="3024" height="1714" data-path="images/explain-diagram.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-worktree-statusbar-redesign/xcu3ZBKeDU3Zr2SM/images/explain-diagram-dark.png?fit=max&auto=format&n=xcu3ZBKeDU3Zr2SM&q=85&s=a21a0fdbc36aedac69346d4e6834cd66" alt="EXPLAIN diagram view" width="3024" height="1714" data-path="images/explain-diagram-dark.png" />
</Frame>

## View Modes

Toggle between three views using the segmented control above the results:

**Diagram** shows the plan as boxes connected by arrows, top to bottom. Nodes are color-coded by cost: green (cheap) to red (expensive). Click a node to see full details in a popover. Zoom controls are in the bottom-right corner.

<Frame caption="EXPLAIN tree view">
  <img className="block dark:hidden" src="https://mintlify.s3.us-west-1.amazonaws.com/ngquct-worktree-statusbar-redesign/images/explain-tree-light.png" alt="EXPLAIN tree view" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-worktree-statusbar-redesign/xcu3ZBKeDU3Zr2SM/images/explain-tree-dark.png?fit=max&auto=format&n=xcu3ZBKeDU3Zr2SM&q=85&s=67b02bc4fd622354014b47fd7309ff51" alt="EXPLAIN tree view" width="3024" height="1714" data-path="images/explain-tree-dark.png" />
</Frame>

**Tree** shows the plan as an expandable outline list. Click a row to see its properties in the detail panel below. Cost and row estimates are shown on the right side of each row.

**Raw** shows the original EXPLAIN output as text (JSON for PostgreSQL and MySQL, plain text for others).

## Database Support

| Database      | Format                                | Variants                              |
| ------------- | ------------------------------------- | ------------------------------------- |
| PostgreSQL    | JSON (parsed into diagram/tree)       | EXPLAIN, EXPLAIN ANALYZE              |
| MySQL/MariaDB | JSON (parsed into diagram/tree)       | EXPLAIN                               |
| SQLite        | EXPLAIN QUERY PLAN (parsed into tree) | Explain                               |
| ClickHouse    | Indented text                         | Plan, Pipeline, AST, Syntax, Estimate |
| DuckDB        | Indented text                         | Explain                               |
| Cloudflare D1 | EXPLAIN QUERY PLAN                    | Query Plan                            |
| BigQuery      | Dry run cost estimate                 | Dry Run                               |

## Plan Details

Each node in the plan shows:

* **Operation**: Seq Scan, Index Scan, Hash Join, Nested Loop, Sort, etc.
* **Table**: which table the operation accesses
* **Cost**: startup and total cost estimates (PostgreSQL format: 0.00..45.18)
* **Rows**: estimated number of rows
* **Actual time**: real execution time per node (EXPLAIN ANALYZE only)

Click a node to see all properties including join type, index name, filter conditions, and sort keys.

<Note>
  EXPLAIN does not execute the query. EXPLAIN ANALYZE executes it and shows actual timing; use it cautiously on production systems.
</Note>
