March 19, 2010

TOP 5 costly Stored Procedures in a SQL Server Database

I was recently doing a query to find out the Stored Procedures which took maximum time to execute. Here’s the query (thanks to gbn) I executed on a sample database (AdventureWorks) using SQL Server 2005/2008:

SELECT TOP 5, max_logical_reads, max_elapsed_time
FROM sys.dm_exec_query_stats a
CROSS APPLY sys.dm_exec_sql_text(sql_handle) hnd
INNER JOIN sys.sysobjects obj on hnd.objectid =
ORDER BY max_logical_reads DESC



If you know of a better way, please share it in the comments section.

Did you like this post?
kick it on
subscribe via rss subscribe via e-mail
print this post follow me on twitter

About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal



0 Responses to "TOP 5 costly Stored Procedures in a SQL Server Database"

Copyright © 2009-2016 All Rights Reserved for by Suprotim Agarwal | Terms and Conditions