The connection string timeout only influences the login timeout. You seems to hit a command timeout, and that can be changed only by modifying the CommandTimeout
. The default value is 30 seconds, the recommended value is 0 (infinite timeout).
As for why your procedure hits random slow execution, I recommend to start by reading Slow in the Application, Fast in SSMS? Understanding Performance Mysteries
BTW, your query is likely not blocked. It executes a different plan that simply takes that long to execute. Checking for last_wait_type
in sys.dm_exec_requests
will likely reveal IO waits (PAGEIOLATCH, after to chasse any red-herring CXPACKET down the sys.dm_os_workers join...). But there is no point repeating the far more comprehensive and excellent article by Erland Sommarskog I originally linked.