Skip to content

Show SQL Server execution plans in the plan viewer #3603

Closed

Description

@datlechin

Problem

Query > Explain Query is dimmed on SQL Server. The plan viewer draws diagrams and trees for PostgreSQL, MySQL, MariaDB, SQLite, ClickHouse, DuckDB, Spanner, SAP HANA and others, and SQL Server is not in its support table (features/explain-visualization.mdx:134-155). The plugin declares no plan variants (the SQL Server plugin sets no explainVariants, so it gets the empty default at apple/Plugins/TableProPluginKit/DriverPlugin.swift:179).

Reading a SQL Server plan today means running SET SHOWPLAN_XML ON by hand and reading the XML in a cell. The missing index hints and warnings the server puts in that XML go unseen.

A variant today is a SQL prefix run with the statement (apple/Plugins/TableProPluginKit/ExplainVariant.swift). SQL Server takes SET SHOWPLAN_XML ON in a batch of its own, so the driver needs its own step to collect the plan.

Proposed solution

  • Two variants under Explain: Estimated Plan (SET SHOWPLAN_XML ON, the query does not run) and Actual Plan (SET STATISTICS XML ON, the query runs, with the same Safe Mode prompt as EXPLAIN ANALYZE). The setting is turned off again on the same session afterwards, also when the plan fails.
  • A parser for the showplan XML that maps each RelOp to a plan node: physical and logical operator, object and index, estimated rows, estimated subtree cost, and, on an actual plan, actual rows, executions and elapsed time.
  • MissingIndexes from the XML shown in the detail pane, with a CREATE INDEX statement to copy.
  • Plan warnings (implicit conversion, spill to tempdb, no join predicate) shown as a badge on the node.
  • A login without the SHOWPLAN permission gets that reason in the error, not an empty plan.

Done when: both variants draw the diagram and tree for a join over three tables on SQL Server 2019 and 2022 and on Azure SQL Database, and a query on an unindexed filter column shows its missing index hint.

Alternatives considered

Run SET SHOWPLAN_XML ON in a query tab, copy the XML out of the result cell and open it in another tool.

Platform

macOS

Related database type

SQL Server

Activity

  1. added
    enhancement
    platform-macos
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementplatform-macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions