Skip to content

Add EXPLAIN ANALYZE visual query plan viewer#29

Merged
muk2 merged 2 commits intomainfrom
feature/issue-12-explain-viewer
Feb 20, 2026
Merged

Add EXPLAIN ANALYZE visual query plan viewer#29
muk2 merged 2 commits intomainfrom
feature/issue-12-explain-viewer

Conversation

@muk2
Copy link
Owner

@muk2 muk2 commented Feb 18, 2026

Summary

Implements Issue #12 — a visual query plan viewer that parses EXPLAIN output into a color-coded tree.

  • Automatically detects EXPLAIN/EXPLAIN ANALYZE queries
  • Renders the execution plan as a visual tree with cost annotations
  • Color-coded nodes: green (fast, <10% total), yellow (moderate, 10-30%), red (slow, >30%)
  • Shows estimated vs actual row count mismatches with warning indicators
  • Displays planning time and execution time footer
  • Ctrl+E toggles between visual tree and raw text views

Changes

File Changes
src/explain.rs New module: PlanNode, QueryPlan structs, EXPLAIN text parser, color classification, 9 unit tests
src/main.rs Added mod explain
src/ui/app.rs Added explain_plans, show_visual_plan, plan_scroll fields, EXPLAIN detection in execute_query(), Ctrl+E toggle in results handler
src/ui/components.rs Added draw_explain_plan(), render_plan_node() tree renderer with color-coded spans, updated help overlay

Test plan

  • All 133 tests pass (124 existing + 9 new)
  • cargo clippy clean
  • cargo fmt clean
  • Manual test: Run EXPLAIN SELECT * FROM table → visual plan displays
  • Manual test: Run EXPLAIN ANALYZE SELECT ... → plan with actual times
  • Manual test: Ctrl+E toggles between visual and raw view
  • Manual test: Color coding reflects relative cost of each node
  • Manual test: Row estimate mismatches shown with warning

🤖 Generated with Claude Code

muk2 and others added 2 commits February 18, 2026 23:27
Parses EXPLAIN output into a visual tree with color-coded cost
annotations. Green nodes are fast (<10% of total), yellow moderate
(10-30%), red slow (>30%). Shows estimated vs actual row mismatches
with warning indicators. Supports both EXPLAIN and EXPLAIN ANALYZE.
Ctrl+E toggles between visual tree and raw text views.

Closes #12

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integrate table inspector, export results, and other features from
main alongside the EXPLAIN ANALYZE viewer. All additions are
independent — kept both sides in each conflict.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@muk2 muk2 merged commit 933d230 into main Feb 20, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant