This is a mirror of official site: http://jasper-net.blogspot.com/

SQL Server: Identify Memory and Performance Issues in T-SQL Queries and Fix them

| Sunday, March 20, 2011
Sometimes you may notice that some T-SQL queries are taking too much time to execute and thus slowing down the performance of SQL Server and other applications. You can find and rectify these queries using the following methods:

Method 1 : Use Dynamic Management View

SELECT
txt.text, total_elapsed_time
FROM
sys.dm_exec_query_stats stat
CROSS APPLY sys.dm_exec_sql_text (stat.sql_handle) txt
ORDER BY
total_elapsed_time desc

The view sys.dm_exec_query_stats will have statistical information of the cached queries
The view sys.dm_exec_sql_text will show the actual query executed. The output will show the results based on the time, the query takes to run, which you can identify and improve upon.

Read more: SQL Server curry

Posted via email from Jasper-net

0 comments: