Repository navigation
Conversation
Three rendering faults, all from assuming a narrower shape than EXPLAIN really has. The tree view grouped rows by id and made every later group a child of the first group's last node. For a UNION that produced unrelated flat nodes and dropped the relationship entirely. Real output has more to work with than the numbering: a UNION RESULT row names its members in the table column as `<union1,2>`, and `<derivedN>`/`<subqueryN>` name a materialised input the same way. Treat those as explicit parent-child edges, keep same-id rows as siblings because they are one SELECT's join order, and fall back to nesting under the nearest lower id only where MySQL has told us nothing. A UNION RESULT with no id of its own — MySQL 5.7 leaves it NULL — sorts just past its members so it still lands in the right place. (#423) MariaDB answers `ANALYZE` with the same twelve columns as EXPLAIN, not with MySQL's single column of TREE text, and the text view joined those columns with newlines: a wall of one word per line. Route on the shape the backend reports rather than on which button was pressed. (#422) TYPE_COLORS knew eight access types, so index_merge, fulltext, spatial and ref_or_null rendered as an unexplained grey badge and never appeared in the legend. The rank map, the colour map and the legend were three places that had to agree; they are now one ordered list, which also retires the unused NULL rank. (#426) The tree cases are transcribed from real EXPLAIN output on MySQL 8 rather than invented — the reported UNION shape in #423 was not what the server actually returns. Refs #422, #423, #426 Co-Authored-By: Claude Opus 5 <[email protected]>
`make db-up` could not seed on a Fedora-style host. The bind-mounted seed files carry a user_home_t label, so the container is denied even as root: MariaDB refused to start at all, and MySQL came up silently empty. Adding :ro,z relabels them to container_file_t, which is the documented fix and a no-op on hosts without SELinux. The readiness check was also wrong in a way that only showed up once the seeding actually ran. MySQL's entrypoint serves the init scripts from a temporary server started with --skip-networking, so `mysqladmin ping` over the socket answers "healthy" while port 3306 is still closed; anything that connected on the strength of it got an EOF moments later. The healthchecks now ping over TCP, which the temporary server does not listen on, and db-up waits on container health rather than running its own ping. MariaDB is brought up alongside MySQL 8 and torn down with it, because its dialect differs in ways worth testing against — ANALYZE rather than EXPLAIN ANALYZE being the immediate one. Co-Authored-By: Claude Opus 5 <[email protected]>
…LUES The executor decides whether a statement answers with a result set by matching a prefix, and the list held only SELECT/SHOW/DESCRIBE/EXPLAIN. Rows are accumulated either way, so anything outside that list had its rows thrown away and reported as a bare rows_affected instead. MariaDB spells EXPLAIN ANALYZE as `ANALYZE <stmt>`, so on MariaDB the whole feature returned nothing at all — which is what the tabular-output report in #422 was really sitting on top of. `WITH ... SELECT` lost its rows the same way, as would TABLE and VALUES. Replaced with a whole-word check over a fuller list, so DESCRIBE is not read as DESC and a table named SELECTIONS is not read as SELECT. The row-limit list is deliberately left alone: appending LIMIT to an ANALYZE or EXPLAIN would rewrite the statement being measured. With the rows arriving, MariaDB's ANALYZE turns out to carry r_rows and r_filtered next to the estimates — the measured values that are the entire reason to run ANALYZE. The table view renders those two columns when the server sends them, so ANALYZE no longer looks identical to EXPLAIN. Verified against MariaDB 11.8 and MySQL 8 in explain_integration. Refs #422 Co-Authored-By: Claude Opus 5 <[email protected]>
Two more from the review of this stack. Adding WITH to the row-returning list fixed `WITH ... SELECT` losing its rows but broke the other half: `WITH doomed AS (...) DELETE FROM t` matched on the leading WITH, so a delete that had just removed rows was reported as an empty result set and the UI told the user nothing was affected. The check now reads the verb the CTE prefixes, via the same helper the ANALYZE safety decision uses, so both halves are right and cannot drift apart. WITH is no longer a member of the list at all. The move to TCP healthchecks was correct for the seeded containers and wrong for mysql-ssl, which runs --require-secure-transport=ON and therefore refuses an unencrypted ping: the container never left "starting" with "Authentication requires secure connection" in its health log. It keeps the unix socket, which is exempt from that setting, and has no seed script, so the temporary-server race the TCP checks avoid cannot arise for it. Confirmed the container now reaches healthy. Refs #422 Co-Authored-By: Claude Opus 5 <[email protected]>
EVWorth
force-pushed
the
fix/explain-plan-rendering
branch
from
August 28, 2026 23:18
a27c42f to
320359f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #422, closes #423, closes #426.
Second of three PRs for
area/explain. Stacked on #512 — review that first; this targets its branch and will retarget tomainonce it lands.Rendering fixes
#423 — the tree view. It grouped rows by
idand made every later group a child of the first group's last node, so a UNION rendered as unrelated flat nodes.Worth flagging: the issue's premise is wrong. It states a UNION's inner SELECTs "both have id=1". They don't — MySQL gives them ids 1 and 2 plus a third
UNION RESULTrow whosetablereads<union1,2>, naming its members explicitly.<derivedN>and<subqueryN>work the same way. I built the tree off those explicit edges rather than off the issue's description; same-id rows stay siblings because they're one SELECT's join order, and nesting under the nearest lower id is only the fallback. AUNION RESULTwith no id of its own (MySQL 5.7 leaves it NULL) sorts just past its members. The stated acceptance criterion still holds.Test cases are transcribed from real
EXPLAINoutput rather than invented.#422 — MariaDB ANALYZE. Two layers, and the second only became visible once the first was fixed:
ANALYZEwith the same columns as EXPLAIN, not MySQL's single column of TREE text. The text view joined those with newlines — a wall of one word per line. Now routed on the shape the backend reports.ANALYZEwasn't in it, so on MariaDB the feature returned nothing at all.WITH ... SELECTlost its rows the same way, as would TABLE and VALUES. Replaced with a whole-word check over a fuller list.r_rows/r_filtered— the measured values that are the whole reason to run ANALYZE. The table renders them when present, so ANALYZE no longer looks identical to EXPLAIN.The row-limit prefix list is deliberately left alone: appending
LIMITto an ANALYZE or EXPLAIN would rewrite the statement being measured.#426 — access types.
TYPE_COLORSknew eight, soindex_merge,fulltext,spatialandref_or_nullrendered as an unexplained grey badge and never reached the legend. The rank map, colour map and legend were three places that had to agree; now one ordered list, which also retires the unusedNULLrank (F15 in #411).Test infrastructure
make db-upcould not seed on a Fedora-style host: bind-mounted seed files carry auser_home_tSELinux label, so the container is denied even as root. MariaDB refused to start; MySQL came up silently empty.:ro,zrelabels them — the documented fix, a no-op without SELinux.The readiness check was wrong too, which only surfaced once seeding actually ran. MySQL serves init scripts from a temporary server started with
--skip-networking, so a socketmysqladmin pinganswers "healthy" while port 3306 is still closed — connect on that and you get an EOF. Healthchecks now ping over TCP, which the temporary server doesn't listen on.MariaDB is wired into
db-up/db-down/db-seedalongside MySQL 8, so dialect differences are testable.Verification
explain_integrationnow runs against both MySQL 8 and MariaDB 11.8 — 10 tests, including that MariaDB's ANALYZE comes back tabular withr_rows/r_filtered, and that the DELETE refusal from #512 holds on MariaDB too. 1623 frontend tests pass; clippy/tsc/dprint clean.🤖 Generated with Claude Code