# Procedure의 응답 시간 보기
select ProcName = isnull(object_name(ProcedureID, DBID), "UNKNOWN"),
DBName = isnull(db_name(DBID), "UNKNOWN"),
ElapsedTime = datediff(ms, min(StartTime), max(EndTime))
from master..monSysStatement
group by SPID, DBID, ProcedureID, BatchID
having ProcedureID != 0
order by datediff(ms, min(StartTime), max(EndTime))
# 부하많은 SQL 찾기
select a.SPID,a.KPID,a.ProcedureID, a.BatchID, a.LineNumber, a.CpuTime, a.WaitTime, a.PhysicalReads, a.LogicalReads,
b.SequenceInBatch, b.SQLText
from temp_monSysStatement a, temp_monSysSQLText b
where a.SPID=b.SPID
and a.KPID=b.KPID
and a.BatchID=b.BatchID
and ProcedureID = 0
and a.StartTime > dateadd(dd,-1 ,getDate())
and CpuTime < 2147483645
and CpuTime+WaitTime >= 50
order by a.SPID,a.KPID,a.BatchID,b.SequenceInBatch
# Wait이 긴 SQL 보기
select p.SPID, p.KPID, p.SecondsWaiting, s.SequenceInLine, s.SQLText, w.Description
from master..monProcess p, master..monWaitEventInfo w, master..monProcessSQLText s
where p.WaitEventID = w.WaitEventID
and p.SPID = s.SPID
and p.KPID = s.KPID
and p.SecondsWaiting > 1
order by p.SecondsWaiting, s.SequenceInLine
[출처] Sybase용 SQL scripts|작성자 도킨스
'IT > DB' 카테고리의 다른 글
[SQL] ANSI, Oracle, MS-SQL에서 outer join 비교 (0) | 2015.07.27 |
---|---|
[Sybase] Mapping Sybase to Oracle types (0) | 2015.07.27 |
[Sybase] Microsoft SQL Server and Sybase Data Types Differences (0) | 2015.07.27 |
[Sybase] oracle과 sybase 비교 (0) | 2015.07.27 |
[Sybase] DB connection 방법 (0) | 2015.07.27 |