Database Tools

SQL Explain Formatter & Query Plan Visualizer

Format, beautify, and interactively visualize SQL EXPLAIN & EXPLAIN ANALYZE execution plans. Identify slow sequential scans, analyze query costs, and pinpoint performance bottlenecks.

Display & Formatting Preferences
Raw Execution Plan
0 chars • 1 line
1
Auto Detect Ready to format
Click node card to inspect properties
No Execution Plan Loaded

Paste an EXPLAIN query plan on the left and click Format & Analyze, or load a sample plan.

Query Execution Metrics Dashboard
Execution Time
--
Planning Time
--
Total Cost
--
Total Nodes
0
Scan Ops
0
Join Ops
0
How to Use the SQL Explain Formatter
  1. Run EXPLAIN in your Database: Execute EXPLAIN or EXPLAIN (ANALYZE, BUFFERS) on your SQL query.
  2. Paste Execution Plan: Copy the output from your database client (psql, DBeaver, pgAdmin, MySQL Workbench, DataGrip) into the left editor.
  3. Select Engine or Auto-Detect: Choose your database dialect (PostgreSQL, MySQL, SQLite, MSSQL, Oracle) or allow smart auto-detection.
  4. Format & Analyze: Click Format & Analyze or press Ctrl+Enter to generate an interactive visual execution tree.
  5. Review Bottlenecks & Metrics: Inspect the Insights tab for high-cost sequential scans, row estimation disparities, and filesort operations.
  6. Copy or Download: Export beautified text plans, parsed JSON structures, or complete Markdown diagnostic reports.
Understanding Key Query Plan Concepts
  • Sequential Scan (Seq Scan / Table Scan): The engine reads every page of the table from disk. Acceptable on small tables, but a red flag on large tables with restrictive filters.
  • Index Scan & Index Seek: Traverses a B-Tree index to locate specific rows. Fast and efficient for selective queries.
  • Nested Loop Join: For every row from the outer table, searches matching rows in the inner table. Very fast with index lookups, but slow with millions of iterations.
  • Hash Join & Merge Join: Pre-hashes or sorts relations before joining. Ideal for large datasets.
  • Query Cost: An arbitrary unitless score estimated by the optimizer representing disk I/O and CPU work.
Knowledge Base

Frequently Asked Questions

Everything you need to know about SQL execution plans and query optimization.

An SQL EXPLAIN execution plan is the internal roadmap generated by a database query optimizer. Before executing a SQL query, the optimizer evaluates available indexes, table statistics, join strategies, and access methods to determine the most cost-effective path to retrieve your requested data. The plan displays the sequence of steps, estimated costs, row counts, and filters used.

EXPLAIN produces an estimated execution plan based solely on database catalog statistics without actually running your query. EXPLAIN ANALYZE (or EXPLAIN (ANALYZE, BUFFERS) in PostgreSQL) actually executes the query against the database, collecting real runtime metrics including elapsed execution time, actual rows returned, loops executed, buffer cache hits, and memory usage. Comparing estimated rows against actual rows is crucial for spotting stale statistics.

PaceTools SQL Explain Formatter supports all major database engines: PostgreSQL (both plain text and JSON plans), MySQL / MariaDB (traditional ASCII grid and EXPLAIN FORMAT=JSON), SQLite (EXPLAIN QUERY PLAN), Microsoft SQL Server (Transact-SQL text showplans), and Oracle (DBMS_XPLAN format). You can choose your database engine or select Auto-Detect.

Not necessarily. "Query Cost" is an abstract, unitless calculation internal to the database query optimizer (roughly calibrated to disk I/O reads and CPU cycles). A query with a high cost may execute in microseconds if all required data blocks reside in warm RAM cache. Conversely, a query with a low cost estimate might run very slowly if the optimizer had outdated statistics and selected an inappropriate nested loop join. Always rely on EXPLAIN ANALYZE runtime measurements when diagnosing performance.

No. Sequential scans are often the fastest access method when a table has very few rows (e.g. fewer than a few hundred rows) or when your query needs to return a significant portion (such as 25% or more) of the entire table. In those scenarios, reading pages sequentially from disk is faster than randomly jumping through index pages and table heap blocks. A sequential scan is only a bottleneck when performed on large tables with restrictive WHERE filters where an index lookup would avoid scanning millions of unnecessary rows.

When actual rows differ by an order of magnitude (e.g., 10x or 100x) from the optimizer's estimate, it almost always points to outdated table statistics or data skew. When the optimizer underestimates row counts, it might choose an inefficient Nested Loop join instead of a Hash Join, leading to severe query stalls. The standard fix is to refresh statistics by running ANALYZE table_name (Postgres/SQLite) or ANALYZE TABLE table_name (MySQL).

Never. PaceTools processes 100% of execution plans client-side within your browser using JavaScript. No database connection is ever made, no SQL is executed on our servers, and your query plans and sensitive schema information never leave your local device.

Yes. You can copy the beautified execution plan, copy the parsed JSON structure, or copy a comprehensive Markdown Performance Analysis report. You can also download the output as a .txt or .json file directly to your computer.
Execution Node Details