I have a specific stored procedure that executes in a SQL Server in about 0.250 seconds, when executed from SQL Server Management Studio, although it takes half a minute to display the resulting dataset of about 100 records in a desktop application.
Is it possible for a DBA to find out when exactly that specific call, to execute this procedure, arrives at the server and thus determining if the problem is situated before or after it is taken up by the server and the execution starts?
Is it possible that a server puts the procedure on the end of his 'list' of procedures to execute and where and how can this be traced?
The procedure does have a history of excessive use of resources, since the original version took about a minute to execute. But the current version certainly does not.
@@optionsset than SSMS uses (e.g.:ARITHABORT) that can cause different execution plans to be created (and so perform well in SSMS but horribly in an application). 2. SSMS has tricks to limit the amount of data it retrieves for large binary/character/XML values so that it appears to run much faster than applications (which have to retrieve everything). 3. Network latency matters, especialy for extremely "chatty" protocols like MS-TDS.@@options, I highly recommend setting aside a day to read, fully understand, and experiment with Erland Sommarskog's Slow in the Application, Fast in SSMS? Understanding Performance Mysteries.