0

I work on a system that comprises of a SQL Server 2012 DB server that is queried frequently with complex queries. Sometimes these queries take more than 2 or 3 mins to return.

How can I record or log the execution plans for these queries when they run for more than a certain time ( configurable - say 1 mins etc ) ?

1

Try using SQL Server Profiler. In SQL Server Management Studio, go to Tools > SQL Server Profiler. It has options to trace which query is running, how long it's running, and you can also specific the time to start and end the trace. It also has option to save the results to a file or in a table.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.