Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 about stored procedure performance tuning

Author  Topic 

dba_maneesh
Starting Member

3 Posts

Posted - 2008-01-09 : 08:16:01
hi
how should i monitor performjance of stored procedure and sql statements. i want to know that how much cpu time a query or stored procedure is taking??

r there any system table which give these information

please give suggestion ASAP

thanx
Maneesh

Hariarul
Posting Yak Master

160 Posts

Posted - 2008-01-09 : 09:32:18
Use SQL Profiler with appropriate events like SP: StmtCompleted ,
T-SQL : StmtCompleted.

Also SQL server 2005 DMVs might help it.
Go to Top of Page

sqldba20
Posting Yak Master

183 Posts

Posted - 2008-01-09 : 10:34:55
Here is the SQL which will give you the Top 50 CPU consumers.... (This will work only in SQL 2005).


select top 50
qs.total_worker_time / execution_count as avg_worker_time,
substring(st.text, (qs.statement_start_offset/2)+1
, ((case qs.statement_end_offset
when -1 then datalength(st.text)
else qs.statement_end_offset
end - qs.statement_start_offset)/2) + 1) as statement_text,
*
from
sys.dm_exec_query_stats as qs
cross apply sys.dm_exec_sql_text(qs.sql_handle) as st
order by
avg_worker_time desc
Go to Top of Page
   

- Advertisement -