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.
| Author |
Topic |
|
dba_maneesh
Starting Member
3 Posts |
Posted - 2008-01-09 : 08:16:01
|
| hihow 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 informationplease give suggestion ASAPthanxManeesh |
|
|
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. |
 |
|
|
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 storder by avg_worker_time desc |
 |
|
|
|
|
|