Skip to content

Port PerformanceStudio's legacy-rule marker: IsLegacy on warnings from pre-framework rules, shown as [legacy] #4566

Closed

Description

@erikdarlingdata

Part of #4511, the sync of plan analysis from PerformanceStudio (PS) to PerformanceMonitor (PM).

erikdarlingdata/PerformanceStudio@aabbaa2 (erikdarlingdata/PerformanceStudio#266) did three things. It dropped rule 21, which #4537 ports, and it stripped the drafted wait-stat text, which PM already matches through the curated Resources/WaitStats.json. The third change is a legacy-rule marker, which PM doesn't have:

  • PlanWarning.IsLegacy, exposed as is_legacy in PS's JSON result.
  • A LegacyWarningTypes set (PS dev PlanAnalyzer.cs ~132) lists the warning types from rules that predate PS's benefit-scoring framework ([FEATURE] Add system to assign a "maximum benefit" for plan analysis rules PerformanceStudio#215): memory grants, local variables, index suggestions, table variables, scalar UDFs and others.
  • MarkLegacyWarnings (PS dev PlanAnalyzer.Helpers.cs ~20–40) sets the flag on analyzer warnings of those types, and never on SQL Server's own warnings (Source == SqlServer). Analyze calls it per statement (PS dev PlanAnalyzer.cs ~116).
  • The renderers show a " [legacy]" tag after the warning type: the viewer's warning lists (PS dev PlanViewerControl.Properties.cs ~862, ~948, ~1024), the advice cards, and the text and HTML output.

PM has the counterpart surfaces: PlanWarning, the MCP plan output (McpPlanAnalysisFormatter), and the shared viewer's warning headers (PlanWarningDisplay). The port is the field, the set, the marking pass, MCP is_legacy, and the viewer tag. PM has no HTML or text exporter, so those halves have no counterpart.

At 08f3e3c4e. PS reference: its dev branch at 85492a1.

Activity

  1. erikdarlingdata commented on Sep 28, 2026

    @erikdarlingdata
    OwnerAuthor

    Claude posting for Erik Darling.

    Fixed in #4585 (71f3ddb). Findings from PerformanceStudio's 21 legacy warning types are marked IsLegacy (never SQL Server's own warnings), shown as is_legacy in the MCP plan output and a [legacy] tag in the plan viewer, matching PerformanceStudio dev.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions