Hello ,
I have here t-SQL query that is executed very frequently and taking long duration I was asking what is place I have to hit to tune this query
UPDATE B SET B.ID = CASE ISNULL(CU.is_Status, 1) WHEN 1 THEN 1 WHEN 3 THEN 2 WHEN 2 THEN 1 END, B.ID = A.ID FROM table1 A INNER JOIN table2 CS ON A.Status = CS.ID INNER JOIN Customers cu ON A.Customer_Id = cu.Id INNER JOIN linkedsrv.dbname.DBO.table2 B ON A.PAN COLLATE database_default=B.ID_2 AND ( (B.ID <>CASE ISNULL(CU.Status, 1) WHEN 1 THEN 1 WHEN 3 THEN 2 WHEN 2 THEN 1 END) OR (B.ID <> A.ID) ) WHERE A.@11 = @12 AND left(a.CUID,7) IN ( SELECT b.name FROM dbo.table3 AS a INNER JOIN dbo.table4 AS b ON a.id_001= b.id WHERE a.id_002=2 )