I have seen this a couple times. There is a job running IndexOptimize that completes successfully, but running sp_BlitzLock will show a deadlock for one specific table. The deadlock command is identical with slightly different start times. I don't see a record in the CommandLog table for this, the job finishes just fine, and I don't see this happening to any other tables but this one particular one.
Command:
ALTER INDEX [PK_TableName] ON [dbo].[TableName] REBUILD WITH (SORT_IN_TEMPDB = ON, ONLINE = ON, MAXDOP = 0)
Job Code:
EXECUTE [dbo].[IndexOptimize]
@Databases = 'DB1, DB2, DB3',
@MinNumberOfPages = 100,
@FragmentationLow = NULL,
@FragmentationMedium = NULL,
@FragmentationHigh='INDEX_REBUILD_ONLINE,INDEX_REBUILD_OFFLINE',
@PartitionLevel = 'N',
@UpdateStatistics = 'ALL',
@StatisticsModificationLevel= '1',
@StatisticsResample = 'Y',
@SortInTempdb = 'Y',
@MaxDOP = 0,
@LogToTable = 'Y',
@TimeLimit = 3600
Deadlock Info:
Basically my question is: given this isn't a "real deadlock" but continues to happen only on this one particular table, is there something I can do to get this to stop showing up? Rebuild the table outside of the IndexOptimize sp? Maybe something else? I would prefer not to just ignore this oddity.
Thanks.