Skip to content

Diag: detect stats on disabled/hypothetical indexes and duplicate-leading-column statistics #616

Description

@nanoDBA

Feature

New diagnostic checks for statistics that are being maintained for zero benefit:

  1. Stats attached to disabled indexes — updated on every run, never used by the optimizer.
  2. Hypothetical indexes / stats (is_hypothetical = 1, typically DTA leftovers) — should be flagged for cleanup, not maintenance.
  3. Duplicate leading-column statistics — multiple stats whose histograms share the same leading column on the same table (auto-created column stat shadowed by an index stat); maintenance cost is duplicated for one histogram's worth of value.

Each finding should include the reversible remediation (e.g. DROP STATISTICS for the redundant auto-created stat) with evidence.

Pattern source: sp_IndexCleanup's metadata funnel (DarlingData).

Activity

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

    diagnosticDiagnostic output, trending, observability improvementsenhancementNew feature or requestp3-nice-to-haveLow-impact enhancement or minor improvement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions