블로그 이미지
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

공지사항

최근에 올라온 글


로킹 시스템 DB 아키텍팅이라는 새로운 업무를 진행중이다. 
어떻게 하면 가장 빠르게 데이터를 넣을 수 있고,
어떻게 하면 가장 빠르게 데이터를 인출 할 수 있을 것인가에 대한 고민이다.

먼저 데이터 삽입에 대해서는 이러한 방법이 테스트의 대상이 될 듯 하다.

방법1
insert into tblx values (1,'minsouk')
go
insert into tblx values (2,'eunkyoung')
go
insert into tblx values (3,'bomi')
go

방법2
begin tran
   insert into tblx values (1,'minsouk')
   go
   insert into tblx values (2,'eunkyoung')
   go
   insert into tblx values (3,'bomi')
   go
commit tran

방법3

if object_id('usp_insert_tblx') is null
exec ('create proc usp_insert_tblx as select 1')
go

alter proc usp_insert_tblx
 @idx int
,@cname varchar(200)
as
insert into tblx values(@idx, @cname)
go

exec usp_insert_tblx 1, 'minsouk'
go
exec usp_insert_tblx 2, 'eunkyoung'
go
exec usp_insert_tblx 3, 'bomi'
go

방법4
begin tran
   exec usp_insert_tblx 1, 'minsouk'
   go
   exec usp_insert_tblx 2, 'eunkyoung'
   go
   exec usp_insert_tblx 3, 'bomi'
   go
commit tran

방법5
sqlcli를 테이블 변수 이용

방법6
insert into tblx values (1,'minsouk'), (2,'eunkyoung'), (3,'bomi')

글을 읽고있는 당신은 무엇이 가장 빠르다고 생각되는가?
더 빠르게 넣을 수 있는 방법이 있다고 생각하는가?
단 쿼리문의 변경과 insert 하는 방법론으로만 이야기를 한정 하고자 한다.
로그 디스크를 어떻게 구성하고 등등은 2부로 하자.

Posted by 보미아빠
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함