Poor perfomance, possiblly due to locks How can I better optimise

ACK 2015-09-04 00:45:01

I have found that when this query is run via the SSMS, for the first time it can time out.
On a second and subsequent runs, even with different parameters, it can return results in < 1 sec I'm at a loss to understand why this is so Any insights would be creatly appreciated
SQLkiwi 2015-09-04 05:28:27
You have set a query time-out in SSMS? Or do you mean connecting to the server times out? Perhaps add the important text from the error message to your question (use the edit button above). Also: running the query directly from Plan Explorer will capture important metrics like I/O and duration. If you can do that, attach the resulting file to your question – it will be very helpful in determining the reason for any slow performance.