블로그 이미지
010-9967-0955 보미아빠

카테고리

보미아빠, 석이 (500)
밥벌이 (16)
싸이클 (1)
일상 (1)
Total
Today
Yesterday

달력

« » 2024.3
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

공지사항

최근에 올라온 글

Array Insert

밥벌이 / 2010. 11. 17. 18:26
46배 빨라지면 쓸만한가?






Begin tran Commit tran 은 빼고 Test 하시길 바랍니다.

alter database t set recovery simple with rollback immediate
go

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

create table tblx
(c1 int
,c2 int
,c3 int
,c4 int
,c5 int
,c6 int
,c7 int
,c8 int
,c9 int
,c10 int
,c11 int
,c12 int
,c13 int
,c14 int
,c15 int
)
go

declare
  @total_loop_count int = 100000
 ,@current_loop_count int = 0
 ,@array_insert int = 0
 ,@start_time datetime2 = getdate()
 ,@end_time datetime2 = getdate()

begin tran
while (1=1) begin
 if @array_insert = 1 begin
  insert into tblx values
       (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
        , (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
  set @current_loop_count += 10
  print @current_loop_count
  if @current_loop_count >= @total_loop_count break;
 end else begin
  insert into tblx values
       (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
  set @current_loop_count += 1
  print @current_loop_count
  if @current_loop_count >= @total_loop_count break;
 end
end
commit tran

select datediff(second, @start_time, getdate()) '입력시간 sec'

'밥벌이' 카테고리의 다른 글

민석이의 waitstat 모니터링  (0) 2010.11.18
부하 데이터생성  (0) 2010.11.18
이 쿼리의 결과는 뭘까요?  (6) 2010.11.04
insert select 로 인해 플랜 공간이 소모됩니다.  (0) 2010.10.28
insert 속도를 높여보자  (1) 2010.10.18
Posted by 보미아빠
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함