Skip to content

Plan viewer: contextual schema lookup on operator right-click #166

@erikdarlingdata

Description

@erikdarlingdata

Feature Request

Add right-click schema lookup (Show Indexes, Show Table Definition, Show Object Definition) to plan viewer operator nodes. This is the plan viewer half of #1.

Prerequisites

Connection toolbar on plan viewer tabs — plans loaded from file have no server connection. The plan viewer needs a Connect button + connection status + database dropdown, consistent with the query editor toolbar. Plans loaded from query execution or Query Store should inherit the session's connection. Plans loaded from file require manual connection.

Which operators support lookup

Only operators that reference data objects should offer schema lookup. Specifically:

Table/index access operators (Show Indexes, Show Table Definition):

  • Clustered Index Scan / Seek
  • Nonclustered Index Scan / Seek
  • Table Scan (heap)
  • Columnstore Index Scan
  • Key Lookup / RID Lookup
  • Index Insert / Update / Delete
  • Table Insert / Update / Delete

Object reference operators (Show Object Definition):

  • Table-valued Function
  • UDF (scalar function references in Compute Scalar)
  • Remote Query (if referencing a known object)

Operators that should NOT offer lookup:

  • Sort, Hash Match, Nested Loops, Merge Join, Filter, Parallelism, etc. — these are execution operators, not data access
  • Constant Scan, Sequence, Concatenation, etc.
  • Compute Scalar (unless it contains a UDF reference)

The object name and index name are available in the plan XML operator attributes (Table, Index, Object).

Temporary objects

Tables like #temp, ##global_temp, @table_variables, and tempdb worktables referenced in spools will appear in plan operators but cannot be looked up:

  • #temp tables exist only in the session that created them — they won't exist when analyzing a saved plan
  • @table_variables are not in sys.indexes / sys.columns
  • Spool worktables are internal to the engine

Behavior: When the referenced object starts with #, @, or is a known internal object (e.g., worktable, worksort), hide the schema lookup menu items — same as we hide them when clicking a keyword in the editor. No error, just not offered.

Display

Same as the query editor implementation: open a new tab with the DDL output (CREATE TABLE / CREATE INDEX / object definition) with SQL syntax highlighting and a close button.

Depends on

Scoped from #1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions