Repository navigation
Closed
Labels
Description
Status: filed
Drives: docs/audits/explain.md
Findings
Critical (P0/P1)
- F1 [P0] [bug] EXPLAIN ANALYZE runs the actual query (UPDATE/INSERT/DELETE/TRUNCATE/DROP) with no confirmation, no production-safety, no read-only enforcement — [P0][bug] EXPLAIN ANALYZE runs the actual query (UPDATE/INSERT/DELETE) with no confirmation, no production-safety, no read-only enforcement #412
- F2 [P0] [bug] executeExplain/executeExplainAnalyze use raw EXPLAIN ${sql} string concat — trailing ; produces EXPLAIN SELECT 1;; which fails for EXPLAIN ANALYZE; multi-statement fails outright — [P0][bug] executeExplain/executeExplainAnalyze use raw EXPLAIN ${sql} string concat — trailing ; fails for EXPLAIN ANALYZE; multi-statement fails outright #418
- F3 [P0] [bug] EXPLAIN ANALYZE has no timeout — runs the actual query, can hang indefinitely on production — [P0][bug] EXPLAIN ANALYZE has no timeout — runs the actual query, can hang indefinitely on production #420
- F4 [P0] [bug] EXPLAIN ANALYZE MariaDB tabular output joined with newlines produces unreadable wall of single-word-per-line text — [P0][bug] EXPLAIN ANALYZE MariaDB tabular output joined with newlines produces unreadable text #422
- F5 [P1] [bug] buildTree groups EXPLAIN rows by id and treats all same-id rows as siblings — UNION queries produce wrong nesting — [P1][bug] buildTree groups EXPLAIN rows by id and treats all same-id rows as siblings — UNION queries produce wrong nesting #423
- F6 [P1] [bug] EXPLAIN doesn't support EXPLAIN FORMAT=JSON or EXPLAIN FORMAT=TREE — only classic tabular format — [P1][bug] EXPLAIN doesn't support EXPLAIN FORMAT=JSON or EXPLAIN FORMAT=TREE — only classic tabular format #424
- F7 [P1] [perf] parseExplainRows is invoked 3 times per render — once in ExplainTable, once in ExplainTreeView, once for maxRows — [P1][perf] parseExplainRows is invoked 3 times per render — once in ExplainTable, once in ExplainTreeView, once for maxRows #425
- F8 [P1] [bug] TYPE_COLORS missing index_merge, fulltext, spatial, ref_or_null — renders gray with no explanation — [P1][bug] TYPE_COLORS missing index_merge, fulltext, spatial, ref_or_null — renders gray with no explanation #426
- F9 [P1] [ux] EXPLAIN ANALYZE panel has no cancel button — running query can't be aborted from this panel — [P1][ux] EXPLAIN ANALYZE panel has no cancel button — running query can't be aborted from this panel #427
Backlog (P2/P3)
- F10 [P2] [perf] ExplainTable renders all 12 columns always — wide tables overflow horizontally without scroll on smaller viewports
- F11 [P2] [doc-drift] ARCHITECTURE §5.2 explain_query Tauri command promised but unimplemented
- F12 [P2] [test] ExplainPanel.test.tsx doesn't test buildTree or parseExplainRows edge cases
- F13 [P3] [bug] ExplainPanel doesn't handle EXPLAIN ANALYZE FORMAT=JSON output — renders as raw text with red highlighting
- F14 [P3] [perf] ExplainTable and ExplainTreeView re-render all rows on viewMode change
- F15 [P3] [convention] TYPE_RANK defines rank for "NULL" (= 7) but the legend filters it out — unused field (went away with the F8 cleanup)
- F16 [P3] [arch] ExplainPanel.tsx is 558 LOC with 9+ sub-components in one file
Good (👍)
- Three complementary views: Table / Tree / ANALYZE
- parseExplainRows lowercases column names defensively
- Access-type color legend in toolbar (worst → best)
- Extra column highlights with 5 distinct keywords
- RowsBar visualises row-estimate scale
- KeyHighlight matches used key against possible_keys
- Reads from useResultStore (clean Zustand integration)
- 20+ tests cover rendering, colors, highlights, view modes
- Graceful fallback for unknown access types
- MariaDB detection for ANALYZE
Doc drift
- DESIGN_REQUIREMENTS FR-2.2.5 ("cost annotations") not delivered (needs FORMAT=JSON — F6)
- DESIGN_REQUIREMENTS FR-10.2.2 partially delivered (colors + tree + cost ❌)
- ARCHITECTURE §3.2 trait signature has no format param
- ARCHITECTURE §5.2 explain_query command unimplemented — F11
- TESTING_STRATEGY has one e2e for EXPLAIN but no integration tests for parsing
Status — 2026-08-28
F1–F5 and F7–F9 are fixed and merged: #512 (safety), #515 (rendering + test infra), #514 (polish). F6 (#424) is deliberately left open — it is a feature rather than a fix, and it is what would deliver the FR-2.2.5 cost annotations tracked as doc-drift in #459.
Three things found during the work that the audit did not have:
- F5's premise was wrong. A UNION's inner SELECTs do not both have
id=1; MySQL numbers them 1 and 2 and adds aUNION RESULTrow naming its members as<union1,2>. The tree is now built from those explicit references. Test cases are transcribed from real server output. - MariaDB's
ANALYZEreturned nothing at all. The executor decided "does this return rows?" by matching a verb, andANALYZEwas not in the list, so the rows were accumulated and then discarded. F4's wall-of-text report was a symptom above this.WITH ... SELECTwas losing its rows the same way, which affected every query path. Fixed in fix(explain): read the plan the server actually returns #515. - A write hidden behind a CTE still ran under ANALYZE.
WITH doomed AS (...) DELETE FROM tis valid MySQL 8; the first fix for F1 read only the leading keyword, sawWITH, and let it execute. Caught in review before merge and fixed in fix(explain): stop EXPLAIN ANALYZE running writes, and make timeouts real #512, which now reads the verb a statement actually acts on.
This backlog (F10–F14, F16) is still open.
Activity
EVWorth commentedon Sep 12, 2026
EXPLAIN visualizer is clear.
What #657 added
A Format picker that re-plans the last statement as the tabular plan, the optimiser's JSON cost model, or MySQL's iterator tree. JSON renders as a collapsible tree with the cost and row keys picked out — in a plan for a real query
query_costis four levels down, and pretty-printed text buries it.The combinations the servers do not have are resolved in Rust rather than left to fail, since an error where a plan should be is a worse answer than the plan you can have: MariaDB has no
FORMAT=TREE(error 1791) and gets the tabular plan; MySQL before 8.3 cannot combine ANALYZE with JSON (error 1235) and gets the plan without timings; MariaDB'sANALYZE FORMAT=JSONdoes carry them. Every row of that was run against MySQL 8.0.46 and MariaDB 11.8 before being written down.And one thing the audit could not have known
Running this suite against MariaDB for the first time found a bug that is not about EXPLAIN at all: a timed-out statement never gave its connection back, so
pool_maxtimeouts exhausted the pool, after whichquery_timeout_secssilently stopped working anddisconnecthung for ever. MySQL happened to recover, which is why every test in the tree missed it. Filed as #658.That is the argument for running the integration suites against both servers rather than one;
MAS_TEST_PORT=13308now does that for the files touched so far.