Skip to content

@parameters_string missing key parameters causes parallel workers to share wrong queue #355

@nanoDBA

Description

@nanoDBA

Bug

When two SQL Agent jobs run sp_StatUpdate with @StatsInParallel = 'Y' but different filtering parameters (e.g., different @ExcludeTables, @ExcludeStatistics, @TieredThresholds, @FilteredStatsMode, or @QueryStorePriority), they incorrectly share the same dbo.Queue row because @parameters_string doesn't include these parameters.

This causes workers from different jobs to claim and process the same tables concurrently, leading to blocking on UPDATE STATISTICS Sch-M locks observed via sp_WhoIsActive.

Root cause

@parameters_string (used as the queue matching key in dbo.Queue.Parameters) only included:

  • @Databases, @Tables, @TargetNorecompute, @ModificationThreshold, @MinPageCount, @IncludeSystemObjects, @SortOrder

Missing parameters that affect discovery results:

  • @ExcludeTables
  • @ExcludeStatistics
  • @TieredThresholds
  • @FilteredStatsMode
  • @QueryStorePriority

Fix

Added all 5 missing parameters to both @parameters_string construction locations (discovery skip path and region 18 queue initialization). Workers with different filtering criteria now get separate queues.

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