You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[P1][bug] EXPLAIN doesn't support EXPLAIN FORMAT=JSON or EXPLAIN FORMAT=TREE — only classic tabular format #424
EXPLAIN in SQLPilot only supports the classic tabular format.
Problem
MySQL 5.6+ supports EXPLAIN FORMAT=JSON (returns nested JSON cost analysis — query_block.cost_info.query_cost, table_name.access_type, etc.) and MySQL 8.0.16+ supports EXPLAIN FORMAT=TREE (returns the iterator tree, which is what EXPLAIN ANALYZE actually outputs). The current code assumes classic tabular format. ARCHITECTURE §3.2 mentions "EXPLAIN [ANALYZE]" but doesn't explicitly mention FORMAT, though the trait signature is explain(connection_id, sql, analyze: bool) — no format param. Adding FORMAT=JSON support would surface real cost analysis (q_block, cost_info) which is far more useful than the tabular approximation.
Files
src/components/explain/ExplainPanel.tsx (no format detection)
src/stores/resultStore.ts:103-117 (no format param)
Repro
EXPLAIN FORMAT=JSON SELECT * FROM users LIMIT 1
EXPLAIN panel renders as text with red highlighting that doesn't match
Expected
A user can select "EXPLAIN FORMAT=JSON" from the toolbar and see the JSON cost breakdown with query_cost: 0.35, table_name.access_type: "ref", etc.
Proposed fix
(1) Add format: 'classic' | 'json' | 'tree' param to executeExplain and executeExplainAnalyze. (2) Render JSON with collapsible key-value tree. (3) Render TREE as the current AnalyzeView text. (4) Add a toolbar dropdown "Format: Classic / JSON / Tree" matching MySQL's syntax. Scope: M.
Acceptance
A user can select "EXPLAIN FORMAT=JSON" from the toolbar and see the JSON cost breakdown.
Needs human verify
yes
Doc drift
partial — ARCHITECTURE §3.2 trait signature has analyze: bool but no format
Activity