Hi, I've a strange situation, this is not the first time I saw that. In such a situation it seems that sql server not execute a SELECT statement in time going in a timeout.
The strange thing is that same query with different value, not sintax, and same client works like a charm. Is it possible for the underscore character ? but other client have the same special char in their name and it works !!
See below:
--This one go in timeout
SELECT DisplayOrderInfo FROM dbo.ORDERS_IN RIGHT JOIN
(SELECT TOP(1) OrderRowInsertedGuid FROM PACKAGE_RECORD WHERE DeviceName = 'B2O_GLME_MASTER_L3' ORDER BY VerificationDate desc) t1
ON dbo.ORDERS_IN.InsertedGuid = t1.OrderRowInsertedGuid
WHERE dbo.ORDERS_IN.State = 2 and Suspended = 0
--This one work like a charm, the only difference is the DeviceName
SELECT DisplayOrderInfo FROM dbo.ORDERS_IN RIGHT JOIN
(SELECT TOP(1) OrderRowInsertedGuid FROM PACKAGE_RECORD WHERE DeviceName = 'B2O_GLME-MASTER_L3' ORDER BY VerificationDate desc) t1
ON dbo.ORDERS_IN.InsertedGuid = t1.OrderRowInsertedGuid
WHERE dbo.ORDERS_IN.State = 2 and Suspended = 0
there are two other client with different name and with 1 million record in join that react in a nanosecond, I've tried to delete completly the records on the right join part but no difference select still go in timeout, In the end I've changed the name of the device to work
This is the versione of Sql Server, but in the past I've seen a similar situation on other sql server
--select @@VERSION
Microsoft SQL Server 2017 (RTM-CU18) (KB4527377) - 14.0.3257.3 (X64) Nov 16 2019 01:14:50 Copyright (C) 2017 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2016 Standard 10.0 <X64> (Build 14393: ) (Hypervisor)