# SQL Explain Plan Visualizer

Parse EXPLAIN / EXPLAIN ANALYZE output (PostgreSQL/MySQL/SQLite) into a cost tree, flag estimated-vs-actual row divergence, and suggest indexes

> Canonical page: https://elysiatools.com/en/tools/sql-explain-plan-visualizer

- **Category:** Development

- **Keywords:** explain, explain analyze, execution plan, query plan, sql, postgresql, mysql, sqlite, index, performance, database tuning, seq scan, cost

## Overview

Parses real EXPLAIN output (PostgreSQL JSON or TEXT, MySQL JSON or classic table, SQLite QUERY PLAN) into an indented, color-coded cost tree showing node type, relation, index, cost, estimated rows, and actual rows/timing (from EXPLAIN ANALYZE). Diagnostics flag sequential scans, statistics divergence, filesorts, temporary tables, non-sargable predicates, and more — each with concrete index/rewrite suggestions.

## Inputs

- **EXPLAIN Output** (textarea): Paste EXPLAIN JSON or TEXT here. e.g. PostgreSQL: \[ { "Plan": { "Node Type": "Seq Scan", "Relation Name": "users", "Actual Rows": 95000, "Plan Rows": 1000 } } \] Or indented text: Seq Scan on users (cost=0.00..1541.00 rows=1000 width=4)
- **Dialect** (select)
- **SQL Query (optional)** (textarea): SELECT * FROM users WHERE lower(email) = 'a@b.com' ORDER BY created_at
- **Tree depth limit** (number)

## When to use

- When a database query is running slowly and you need to pinpoint the exact node causing the bottleneck.
- When you suspect stale database statistics are causing the query planner to choose inefficient scan methods.
- When analyzing complex, nested execution plans that are difficult to read in raw text or JSON formats.

## How it works

- Paste your raw EXPLAIN or EXPLAIN ANALYZE output (JSON or text format) into the input area.
- Select your database dialect (PostgreSQL, MySQL, or SQLite) or let the tool auto-detect it.
- Optionally input the original SQL query to help the visualizer generate precise index recommendations.
- Analyze the generated tree diagram to identify high-cost nodes, sequential scans, filesorts, and row-estimate divergences.

## Use cases

- Visualizing complex PostgreSQL JSON execution plans to locate high-cost sequential scans.
- Detecting stale table statistics by highlighting large gaps between estimated and actual row counts.
- Optimizing slow MySQL queries by identifying temporary tables and filesorts in the execution tree.

## Frequently asked questions

### Which database dialects and formats are supported?

The tool supports PostgreSQL (JSON and text), MySQL (JSON and tabular), and SQLite (QUERY PLAN text).

### How does the tool identify stale database statistics?

It compares the estimated plan rows with the actual rows from EXPLAIN ANALYZE; a difference of 10x or more flags a statistics hotspot.

### Do I need to provide the original SQL query?

No, the SQL query is optional, but providing it allows the tool to suggest specific index columns and query rewrites.

### What types of query bottlenecks are flagged?

It flags sequential scans on large tables, filesorts, temporary tables, expensive nested loops, and non-sargable predicates.

### Is my query plan data sent to an external server?

No, all parsing and visualization are performed locally in your browser to ensure data privacy.

## Related tools

- [Game Save Viewer](https://elysiatools.com/en/tools/game-save-viewer): Drop any game save file — Minecraft NBT, Unreal Engine GVAS, Palworld containers, JSON/XML/INI/Lua text saves, SQLite profiles — and get the detected format, engine versions, key progress fields and a bounded structural tree.
- [CSV to Database Migration Planner](https://elysiatools.com/en/tools/csv-to-database-migration-planner): Infer a relational schema from CSV data and generate create-table plus ALTER migration plans for PostgreSQL, MySQL, SQLite, or SQL Server
- [Structured Log Analyzer](https://elysiatools.com/en/tools/structured-log-analyzer): Detect common log formats, extract core fields, infer field types, and export parsed logs as JSON, CSV, or SQL inserts
- [package.json Dependency Auditor](https://elysiatools.com/en/tools/package-json-dependency-auditor): Audit a package.json for dependency hygiene, version-range quality, and optionally inspect a transitive dependency tree from package-lock.json or yarn.lock. Flags duplicates, wildcard or pre-release specs, unsorted keys, missing metadata, and misclassified runtime/dev dependencies.
- [Time Series Forecast & Seasonality Analyzer](https://elysiatools.com/en/tools/time-series-forecast-seasonality-analyzer): Forecast future periods from CSV or JSON time-series data and inspect trend, seasonal, and residual decomposition in one report
- [GraphQL Playground](https://elysiatools.com/en/tools/graphql-playground): An in-browser GraphQL client: write queries and variables, send them to any GraphQL endpoint, and inspect formatted JSON results or error arrays — perfect for iterating on schemas during development
- [Mock Data Prefix / Abbreviation Conflict Detector](https://elysiatools.com/en/tools/mock-data-naming-conflict-detector): Detect visually confusing field names and prefix collisions in CSV, JSON, or schema inputs, then suggest clearer renames
- [Text Pipeline Builder](https://elysiatools.com/en/tools/text-pipeline-builder): Run a portable text-cleaning recipe and inspect every step, diff, timing, and character change.

## Samples

- [SQL Scripts Samples](https://elysiatools.com/en/samples/sql-samples): SQL query examples and database scripts for various scenarios and use cases (primarily MySQL syntax)
- [SQL Injection Samples](https://elysiatools.com/en/samples/sql-injections): Educational collection of SQL injection payloads for security testing, vulnerability assessment, and defensive coding practices
- [SQL Viewer Samples](https://elysiatools.com/en/samples/sql-viewer-samples): Sample SQL scripts (DDL/DML, joins, CTEs) for the in-browser SQL Viewer
- [PostgreSQL Advanced Samples](https://elysiatools.com/en/samples/postgresql-advanced): Advanced PostgreSQL database examples including optimization strategies, complex queries, indexing, and performance tuning

## Related content

- [SQL Query Review for Performance and Integrity](https://elysiatools.com/en/hubs/sql-query-review-performance-and-integrity): Build, format, and review SQL with join logic, performance evidence, explain plans, injection checks, foreign-key validation, and schema drift review.
