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.
Bug
When two SQL Agent jobs run
sp_StatUpdatewith@StatsInParallel = 'Y'but different filtering parameters (e.g., different@ExcludeTables,@ExcludeStatistics,@TieredThresholds,@FilteredStatsMode, or@QueryStorePriority), they incorrectly share the samedbo.Queuerow because@parameters_stringdoesn't include these parameters.This causes workers from different jobs to claim and process the same tables concurrently, leading to blocking on
UPDATE STATISTICSSch-M locks observed viasp_WhoIsActive.Root cause
@parameters_string(used as the queue matching key indbo.Queue.Parameters) only included:@Databases,@Tables,@TargetNorecompute,@ModificationThreshold,@MinPageCount,@IncludeSystemObjects,@SortOrderMissing parameters that affect discovery results:
@ExcludeTables@ExcludeStatistics@TieredThresholds@FilteredStatsMode@QueryStorePriorityFix
Added all 5 missing parameters to both
@parameters_stringconstruction locations (discovery skip path and region 18 queue initialization). Workers with different filtering criteria now get separate queues.