brewDB EXPLAIN Plan Analysis
brewDB can run EXPLAIN against a query and turn Postgres’s output into a visual, interactive plan — something the legacy application had no equivalent of at all, since it had no query interface to begin with.
What EXPLAIN Analysis Shows
Section titled “What EXPLAIN Analysis Shows”You can run EXPLAIN two ways: as a real ANALYZE, which actually executes the query and reports real timings, or as plan-only, which shows Postgres’s planned execution strategy without running it. Either way, brewDB parses Postgres’s FORMAT JSON output into an interactive tree you can explore node by node, rather than reading raw JSON or text output.
Reading the Heatmap
Section titled “Reading the Heatmap”Each node in the plan tree is colored by a self-time heatmap, making it easy to see at a glance which parts of the plan are consuming the most time relative to the rest of the query.
Auto-Flagged Issues
Section titled “Auto-Flagged Issues”brewDB automatically flags common problem patterns in the plan, including:
- Sequential scans
- Misestimates
- Disk sorts
- Nested-loop blowups
Write-Guard for ANALYZE
Section titled “Write-Guard for ANALYZE”Because ANALYZE actually executes the query, running it against a statement containing writes or DDL would apply those changes. brewDB’s write-guard catches this and offers a choice: run in a rolled-back transaction, so the query executes and reports real timings but nothing is committed, or fall back to explain-only, which shows the plan without running the query at all.