SQL 사용자 Tip & 강좌
작성자: 차주언
작성일: 2010-08-30
연락처: narsas@naver.com / 010-2745-1853
http://www.sqler.com/127504 글에 내용을 추가해봅니다
결론만 말하면 SQL SERVER 2008 에선 INSERT INTO ... WITH (tablock) = SELECT * INTO
로깅이 같습니다. ^^
그외는 해보면 끔직해서 실험생략.. 해보실분은 해보세요~
2개 비교한겁니다.
USE AdventureWorks GO -- 복구모델Simple겠죠? -- 검사쿼리 select operation,context, [log record fixed length], [log record length], AllocUnitId, AllocUnitName from fn_dblog(null, null) where allocunitname='dbo.t1' order by [Log Record Length] Desc -- 원본테이블 SELECT * FROM Person.Address -- 1.힙테이블+ select into -- 있으면삭제 IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[t1]') AND type in (N'U')) DROP TABLE [dbo].[t1] GO SELECT * INTO t1 FROM Person.Address -- 19614 행입력 -- 검사쿼리 select operation,context, [log record fixed length], [log record length], AllocUnitId, AllocUnitName from fn_dblog(null, null) where allocunitname='dbo.t1' order by [Log Record Length] Desc -- 487 Rows 기록 -- 2.힙테이블+ insert into -- 있으면삭제 IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[t1]') AND type in (N'U')) DROP TABLE [dbo].[t1] GO CREATE TABLE [dbo].[t1]( [AddressID] [int] NOT NULL, [AddressLine1] [nvarchar](60) NOT NULL, [AddressLine2] [nvarchar](60) NULL, [City] [nvarchar](30) NOT NULL, [StateProvinceID] [int] NOT NULL, [PostalCode] [nvarchar](15) NOT NULL, [rowguid] [uniqueidentifier] NOT NULL, [ModifiedDate] [datetime] NOT NULL ) ON [PRIMARY] GO INSERT INTO t1 with (tablock) SELECT * FROM Person.Address -- 19614 행입력 -- 검사쿼리 select operation,context, [log record fixed length], [log record length], AllocUnitId, AllocUnitName from fn_dblog(null, null) where allocunitname='dbo.t1' order by [Log Record Length] Desc -- 487 Rows 기록

차주언
MSSQL DBA , MCT/ MCDBA
SQL프런티어 /

차주언
코난

사진이 멋져요~ ㅎㅎ