# Phase 21 — SQL Query Plan Inspector Based on Phase 20. ## Added - **Explain** button in SQL editor toolbar. Uses selected SQL when present, otherwise editor SQL. - Separate query-plan window showing MySQL `EXPLAIN` in table format or `EXPLAIN FORMAT=JSON`. - Shows optimizer plan columns in the existing native result grid; JSON format is selectable and copyable. - Displays diagnostic query duration and server errors. - Limits analysis to SELECT/WITH statements, does not run `EXPLAIN ANALYZE` (which executes the query). - Does not replace editor query results or add EXPLAIN to normal query history. ## Notes - Requires an active connection and MySQL permissions to explain the query. - `EXPLAIN` gives estimated plans, not actual execution metrics. - Only a single SQL statement should be selected; multi-statement SQL is not supported in the plan inspector. - Not built in Xcode or tested against a live MySQL server in this environment.