> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tablepro.app/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, or use **Query > Explain Query** (default shortcut `Cmd+Option+E`), to get the execution plan for the current query.

Databases with multiple EXPLAIN variants show a dropdown: PostgreSQL offers **EXPLAIN** (estimated plan) and **EXPLAIN ANALYZE** (runs the query and shows actual timing); MySQL and MariaDB offer **EXPLAIN** and **EXPLAIN (JSON)**. Databases with a single variant, like SQLite or DuckDB, show a plain 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/k2-lKQ_N49HT3JyI/images/explain-diagram.png?fit=max&auto=format&n=k2-lKQ_N49HT3JyI&q=85&s=7e1bf2a2e49756496dcd3d212f56e755" alt="EXPLAIN diagram view" width="3024" height="1714" data-path="images/explain-diagram.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct/k2-lKQ_N49HT3JyI/images/explain-diagram-dark.png?fit=max&auto=format&n=k2-lKQ_N49HT3JyI&q=85&s=f6e59a9d03ad5abc740731fc260a64ea" 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://mintcdn.com/ngquct/k2-lKQ_N49HT3JyI/images/explain-tree.png?fit=max&auto=format&n=k2-lKQ_N49HT3JyI&q=85&s=232f44b6b38e4b9cd4a50e353bfbdf62" alt="EXPLAIN tree view" width="3024" height="1714" data-path="images/explain-tree.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct/k2-lKQ_N49HT3JyI/images/explain-tree-dark.png?fit=max&auto=format&n=k2-lKQ_N49HT3JyI&q=85&s=021adfb230cdc474e29d69c914a69fb7" 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, with a copy button and a font size stepper in the toolbar. When the plan includes timing, planning and execution times are shown next to the view switcher.

## Database Support

| Database        | Variants                              | Output                                                                             |
| --------------- | ------------------------------------- | ---------------------------------------------------------------------------------- |
| PostgreSQL      | EXPLAIN, EXPLAIN ANALYZE              | JSON, parsed into diagram and tree                                                 |
| Redshift        | Explain                               | Raw text                                                                           |
| CockroachDB     | EXPLAIN, EXPLAIN ANALYZE              | Text plan, parsed into diagram and tree                                            |
| MySQL / MariaDB | EXPLAIN, EXPLAIN (JSON)               | JSON variant parsed into diagram and tree; plain EXPLAIN stays in the results grid |
| SQLite          | Explain                               | EXPLAIN QUERY PLAN, parsed into diagram and tree                                   |
| ClickHouse      | Plan, Pipeline, AST, Syntax, Estimate | Indented text, parsed into diagram and tree                                        |
| DuckDB          | Explain                               | Indented text, parsed into diagram and tree                                        |
| Cloudflare D1   | Query Plan                            | EXPLAIN QUERY PLAN, raw text                                                       |
| LibSQL / Turso  | Query Plan                            | EXPLAIN QUERY PLAN, raw text                                                       |
| Snowflake       | Explain (Text)                        | Raw text                                                                           |
| SurrealDB       | Explain, Explain Full                 | Raw text                                                                           |
| BigQuery        | Dry Run (Cost)                        | Dry run cost estimate                                                              |
| MongoDB         | Explain                               | `explain` runCommand with execution stats                                          |
| Redis           | Explain                               | `DEBUG OBJECT` for the command's key                                               |

## 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>
