Hello, I need help.
MS SQL
I do many updates ~30 (one table) from 3 threads every 5 seconds. Device polling.
Get SequelizeDatabaseError: Transaction (Process ID 57) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
sql: 'SET IDENTITY_INSERT [DeviceCurrentData] ON; MERGE INTO [DeviceCurrentData] WITH(HOLDLOCK) AS [DeviceCurrentData_target] USING (VALUES(9, N\'28.300000\', \'2017-08-07 15:26:28.000\', 12)) AS [DeviceCurrentData_source]([Id], [Value], [DateStamp], [DevParamId]) ON [DeviceCurrentData_target].[Id] = [DeviceCurrentData_source].[Id] WHEN MATCHED THEN UPDATE SET [DeviceCurrentData_target].[Value] = N\'28.300000\', [DeviceCurrentData_target].[DateStamp] = \'2017-08-07 15:26:28.000\', [DeviceCurrentData_target].[DevParamId] = 12 WHEN NOT MATCHED THEN INSERT ([Id], [Value], [DateStamp], [DevParamId]) VALUES(9, N\'28.300000\', \'2017-08-07 15:26:28.000\', 12) OUTPUT $action, INSERTED.*; SET IDENTITY_INSERT [DeviceCurrentData] OFF;'