Visual EXPLAIN
Analyze PostgreSQL query performance with tpaw's interactive EXPLAIN ANALYZE plan tree.
Visual EXPLAIN parses the JSON output of a PostgreSQL EXPLAIN query and renders it as an interactive collapsible tree. Each node in the plan shows its type, cost estimates, row estimates, and — when using EXPLAIN ANALYZE — actual execution time and row counts. A color bar on each node's left edge indicates its relative cost within the plan.
Running EXPLAIN
In the query editor, click the Explain button in the toolbar, or prepend your query with EXPLAIN or EXPLAIN ANALYZE and run it normally. tpaw detects when a result contains a QUERY PLAN column and automatically switches to the visual plan view instead of the standard data grid.
For actual timing data, use:
Without ANALYZE, the plan shows only estimated costs and rows.
Summary bar
At the top of the plan view, a summary bar shows:
| Field | Description |
|---|---|
| Total cost | The planner's estimated total cost for the root node |
| Planning | Time spent planning the query (with ANALYZE only) |
| Execution | Total execution time in milliseconds (with ANALYZE only) |
Plan tree
Each node in the tree is rendered as a card with:
Node header
- Node Type — the operation name (e.g.,
Seq Scan,Hash Join,Index Scan) - Relation name — the table or index being accessed, with alias if different (e.g.,
orders (o)) - A +/− toggle button for nodes with child nodes
Metrics badges
Each node card shows up to four badges:
| Badge | Description |
|---|---|
| cost | Startup cost .. Total cost (planner estimate) |
| rows | Actual rows / Estimated rows (actual shown only with ANALYZE) |
| time | Actual total time in ms (shown only with ANALYZE) |
| width | Average output row width in bytes |
Cost color bar
The left border of each card is color-coded by relative cost:
- Green — cost is less than 33% of the plan's maximum node cost
- Orange/peach — cost is between 33% and 66% of maximum
- Red — cost is above 66% of maximum — the most expensive nodes in the plan
This makes it easy to identify the costliest operations at a glance.
Collapsing nodes
Click the − button on any node with children to collapse its subtree. Click + to expand it again. This is useful for large plans where you want to focus on a specific branch without scrolling through many nested child nodes.
Tips
- Use
EXPLAIN ANALYZEto get actual row counts alongside estimates — large discrepancies between estimated and actual rows often indicate stale table statistics (ANALYZEyour tables). - Nodes at the bottom of the tree are executed first (leaves before parents). Start there when investigating slow plans.
- High cost on a
Seq Scanwith many rows suggests a missing index on the filtered columns.