컴퓨터&모바일/MSSQL
-
MSSQL CPU 사용률 높은 쿼리 찾아내는 쿼리컴퓨터&모바일/MSSQL 2019. 8. 1. 10:06
SELECT TOP 50 qs.creation_time, qs.execution_count, qs.total_worker_time astotal_cpu_time, qs.max_worker_time as max_cpu_time, qs.total_elapsed_time,qs.max_elapsed_time, qs.total_logical_reads, qs.max_logical_reads, qs.total_physical_reads, qs.max_physical_reads, t.[text], qp.query_plan, t.dbid, t.objectid, t.encrypted, qs.plan_handle, qs.plan_generation_num FROM sys.dm_exec_query_stats qs CROSS..
-
mssql 로그오류 확인컴퓨터&모바일/MSSQL 2015. 4. 1. 15:52
create proc sys.sp_readerrorlog( @p1 int = 0, @p2 int = NULL, @p3 varchar(255) = NULL, @p4 varchar(255) = NULL) as begin if (not is_srvrolemember(N'securityadmin') = 1) begin raiserror(15003,-1,-1, N'securityadmin') return (1) end if (@p2 is NULL) exec sys.xp_readerrorlog @p1 else exec sys.xp_readerrorlog @p1,@p2,@p3,@p4 end 총 4개의 파라메타가 있는데 각 파라메타의 의미는 다음과 같습니다. @p1 : 0 = 현재 로그, 1 = 보관된 첫번째 로그, ..
-
index 생성 조회 삭제컴퓨터&모바일/MSSQL 2014. 12. 21. 11:35
인덱스 생성 CREATE INDEX [인덱스명] ON [테이블명] ([컬럼명] [정렬방식]) CREATE INDEX ix_shpbarcod ON tbl_workdetail (shpbarcod asc) 인덱스 조회 sp_helpindex [테이블명] sp_helpindex 'tbl_workdetail' SELECT * FROM sys.indexes WHERE NAME = [인덱스명] SELECT * FROM sys.indexes WHERE NAME = 'ix_PDA_SALEDTL_1' SELECT * FROM sys.indexes a left join sys.sysobjects b on a.object_id = b.id WHERE a.is_unique = 0 and a.name is not null and..