Running with @operation='all' if a partitioned table is rebuilt then statistics are skipped. Rebuilding a single partition does not help statistics for the whole index. May I suggest;
- where _idx.SkipIndex=0 and _idx.OperationToTake='REBUILD'
+ where _idx.SkipIndex=0 and _idx.OperationToTake='REBUILD' and _idx.IsPartitioned=0
Running with
@operation='all'if a partitioned table is rebuilt then statistics are skipped. Rebuilding a single partition does not help statistics for the whole index. May I suggest;