블로그 이미지
SQL Server VS. 석이 minsouk@hotmail.com MSSQL 쿼리성능 관련해 궁금한 사항이 있다면 언제나 누구나 TeamViewer + Line (네이버 japan 메신저) 에 minsouk1 추가 후 연락주세요~ 010-9967-0955 보미아빠

카테고리

보미아빠, 석이 (433)
밥벌이 (16)
싸이클 (1)
일상 (1)
Total185,809
Today895
Yesterday74

달력

« » 2017.08
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

공지사항

부하 데이터생성

밥벌이 / 2010.11.18 16:05

if object_id('sm_cpu_pfmnc_log') is not null
drop table sm_cpu_pfmnc_log
go

create table sm_cpu_pfmnc_log
(
     host_id              CHARACTER VARYING(13)
,     log_ocr_ymdt         datetime
,     cpu_idx              SMALLINT
,     used_rto             NUMERIC(20,2)
,     idel_rto             NUMERIC(20,2)
,     user_rto             NUMERIC(20,2)
,     sys_rto              NUMERIC(20,2)
,     nice_rto             NUMERIC(20,2)
,     irq_rto              NUMERIC(20,2)
,     softirq_rto          NUMERIC(20,2)
,     io_wait_rto          NUMERIC(20,2)
,     prv_mde_exec_tm_rto  NUMERIC(20,2)
,     dly_pcd_call_tm_rto  NUMERIC(20,2)
)

--select * from sm_cpu_pfmnc_log

;with nums as (
select 0 a union all select 1 union all select 2 union all select 3 union all select 4 union all
select 5 union all select 6 union all select 7 union all select 8 union all select 9
)
, mm as (select a.a+b.a*10 mm from nums a ,nums b where a.a+b.a*10 < 60)
, hh as (select a.a+b.a*10 hh from nums a ,nums b where a.a+b.a*10 < 24)
, hostname as (select a.a+b.a*10+c.a*100+d.a*1000 hostname from nums a, nums b, nums c, nums d where a.a+b.a*10+c.a*100+d.a*1000 < 2)
insert into sm_cpu_pfmnc_log
select right('000000000000000'+cast(hostname as varchar(100)), 13) host_id
  , dateadd(hh, hh, dateadd(mi, mm , getdate())) log_ocr_ymdt
  , hh % 8 cpu_idx
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) used_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) idel_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) user_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) sys_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) nice_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) irq_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) softirq_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) io_wait_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) prv_mde_exec_tm_rto
  , cast(abs(checksum(newid()))/3.33 as numeric(20,2)) dly_pcd_call_tm_rto
  from hostname, hh, mm
order by 2

-- 아래와 같이 파일로 생성
select right(cast(used_rto as varchar(20)),5), * from sm_cpu_pfmnc_log order by log_ocr_ymdt
-- 생성된 파일을 array insert 하기로 함

신고
Posted by 보미아빠

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

티스토리 툴바