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
 General SQL Server Forums
 New to SQL Server Programming
 Queries running in particular data base

Author  Topic 

cherukuri222
Starting Member

4 Posts

Posted - 2013-03-28 : 15:11:40
1) How many queries are hitting database?
2) What are the queries?
3) Which queries is taking long time to execute.?

In sql server 2005 and 2008

siva

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-03-28 : 15:42:55
sql profiler

Be One with the Optimizer
TG
Go to Top of Page

cherukuri222
Starting Member

4 Posts

Posted - 2013-03-29 : 02:27:01
hi TG
i think sql profiler is not preferable in sql server.
please give another solution , in T-Sql

siva
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-03-29 : 03:36:34
--To Display the Top 25 Most expensive read I/O queries
SELECT TOP 25 cp.usecounts AS [execution_count]
,qs.total_worker_time AS CPU
,qs.total_elapsed_time AS ELAPSED_TIME
,qs.total_logical_reads AS LOGICAL_READS
,qs.total_logical_writes AS LOGICAL_WRITES
,qs.total_physical_reads AS PHYSICAL_READS
,SUBSTRING(text,
CASE WHEN statement_start_offset = 0
OR statement_start_offset IS NULL
THEN 1
ELSE statement_start_offset/2 + 1 END,
CASE WHEN statement_end_offset = 0
OR statement_end_offset = -1
OR statement_end_offset IS NULL
THEN LEN(text)
ELSE statement_end_offset/2 END -
CASE WHEN statement_start_offset = 0
OR statement_start_offset IS NULL
THEN 1
ELSE statement_start_offset/2 END + 1
) AS [Statement]
FROM sys.dm_exec_query_stats qs join sys.dm_exec_cached_plans cp on qs.plan_handle = cp.plan_handle CROSS APPLY sys.dm_exec_sql_text(cp.plan_handle) st ORDER BY qs.total_logical_reads DESC;
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-03-29 : 13:49:28
quote:
Originally posted by cherukuri222

hi TG
i think sql profiler is not preferable in sql server.
please give another solution , in T-Sql

siva


why profiler is not preferable?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -