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

카테고리

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

달력

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

공지사항

최근에 올라온 글

 

SQL 2012 EE Server+CAL model has a 20 physical cores limitation

(20 logical cores without hyperthreading or 40 logical cores with hyperthreading turned on).

 

80개 이상 사용 하려면,

SQL Server 2012 EE core 라이선스가 필요하다

 

http://sqlperformance.com/2012/11/system-configuration/2012-cal-problems

에 재현이 되어 있다.

 

고르게 쓰는 방법은 현재 numa 노드당 일량을 던져주는 부분이 라운드 로빈이다. 그러므로 numa0 번과 1번에 같은양을 일량을 주게 된다. 그럼 numa 1번에 할당된 스케줄러가 적어서 일량이 몰릴수 있다.

이런경우 affinity mask 를 써서 numa 노드당 스케줄러를 동일하게 배치하면된다. 그런데 이경우 load factor 에 의해 스케줄러를 옮겨가면서 일을 하지 못한다. ...... 어쩌란 말인가....쓰지 말라는 말인가......

 

 

Posted by 보미아빠
, |

inner remote join

카테고리 없음 / 2013. 8. 25. 15:09

원격서버와 조인 할 때 loop join 을 반드시 해야하고, join predicate 를 원격서버로 넘겨주고자 할때는 inner remote join 이라고 명시적으로 힌트를 기술하면 된다. 이 힌트는 inner remote loop join 등과 같이 join 방식(loop, merge, hash)을 명시하지 못한다. 왜냐하면 loop join 으로만 풀리기 때문이다. 자세한 내용은 bol 을 참고하길 바란다.
http://technet.microsoft.com/ko-kr/library/ms173815.aspx

 

데이터 생성 스크립트 remotedb

 

WITH TEMP AS
(
SELECT TOP 1000000
    CAST(ROW_NUMBER() OVER (ORDER BY (SELECT 1)) AS INT) IDX
  , 'PNAME_'+RIGHT(REPLICATE('0',7)+CAST(CAST(ABS(CHECKSUM(NEWID())) % 1000 AS INT) AS VARCHAR(10)),7)+CHAR(ASCII('A') + ABS(CHECKSUM(NEWID()))%10) PRODUCTNAME
  FROM SYS.OBJECTS A1
 CROSS JOIN SYS.OBJECTS A2
 CROSS JOIN SYS.OBJECTS A3
 CROSS JOIN SYS.OBJECTS A4
 CROSS JOIN SYS.OBJECTS A5
)
SELECT IDX, PRODUCTNAME, CAST(SUBSTRING(PRODUCTNAME,7,7) AS INT) PRODUCTID
  , CAST(ABS(CHECKSUM(NEWID())) % 100 AS INT) SHOPID
  , CAST(ABS(CHECKSUM(NEWID())) % 1000000 AS INT) PRICE
  , DATEADD(MINUTE, CAST(ABS(CHECKSUM(NEWID())) % 20000 AS INT) * -1, GETDATE()) INSERTTIME
  INTO TBLX
  FROM TEMP
GO

 

localdb 데이터 생성 시나리오는 위 쿼리에서 tblx ,y,z 로 이름만 바꾸어서 생성하면 된다.

 

인덱스 localdb

create clustered index cl_tblx on tblx (idx)
create clustered index cl_tbly on tbly (idx)
create clustered index cl_tblz on tblz (idx)

 

인덱스 remotedb

create clustered index cl_tblx on tblx (idx)

아래 쿼리는 hash 조인으로 동작한다.

SELECT *
  FROM (
  SELECT TOP 1000000 A.IDX, C.INSERTTIME
    FROM TBLX A 
    JOIN TBLY B
   ON A.IDX = B.IDX
    JOIN TBLZ C
   ON A.IDX = C.IDX
    ) LDB
  INNER JOIN MINSOUK.REMOTEDB.DBO.TBLX RDB
    ON RDB.IDX = LDB.IDX

 

remotedb 와 inner join 을 하고 싶다고 inner loop join 이라고 명시하면 join predicate 가 사라지고 remote 데이터 전체를 읽어서 local 로 spool 한뒤 join 하려고 한다. 만약, dba 가 outer reference table (local table) 이 매우작고 inner table (remotedb) 이 크다면, 원격 network round trip 을 감수하고 loop join 을 수행하고 join predicate 를 정상적으로 전달 하고자 한다면, 어떻게 해야 할까? 아래와 같이 inner remote join 이라고 명시하면 된다. 아래에서 outer reference table 을 매우크게 만들었는데, 항상 loop join 이 된다는 것과 join predicate 가 항상 전달 된다는 것을 증명하기 위한 것이다.

 

SELECT *
  FROM (
  SELECT TOP 1000000 A.IDX, C.INSERTTIME
    FROM TBLX A 

    JOIN TBLY B 
   ON A.IDX = B.IDX
    JOIN TBLZ C 
   ON A.IDX = C.IDX
    ) LDB
  INNER REMOTE JOIN MINSOUK.REMOTEDB.DBO.TBLX RDB
    ON RDB.IDX = LDB.IDX

 

 

 

 

그리고 다음 강좌는 코너 아저씨의 DQ 강좌 입니다.

http://sqlbits.com/Sessions/Event10/Distributed_Query_Deep_Dive

 

 

 

Posted by 보미아빠
, |

SQL Server 2012 에서 리부팅이나 클러스터 fail-over 후 

identity 값이 건너뛴다. 


Hello,
First off we do apologize for the late response to this issue.

In SQL Server 2012 the implementation of the identity property has been changed to accommodate investments into other features. In previous versions of SQL Server the tracking of identity generation relied on transaction log records for each identity value generated. In SQL Server 2012 we generate identity values in batches and log only the max value of the batch. This reduces the amount and frequency of information written to the transaction log improving insert scalability.

If you require the same identity generation semantics as previous versions of SQL Server there are two options available:
•         Use trace flag 272
o This will cause a log record to be generated for each generated identity value. The performance of identity generation may be impacted by turning on this trace flag.
•         Use a sequence generator with the NO CACHE setting(http://msdn.microsoft.com/en-us/library/ff878091.aspx)
o This will cause a log record to be generated for each generated sequence value. Note that the performance of sequence value generation may be impacted by using NO CACHE.
o Example:
 CREATE SEQUENCE s1 AS INT START WITH 1 NO CACHE;
CREATE TABLE t1 (Id INT PRIMARY KEY DEFAULT NEXT VALUE FOR s1, col INT NOT NULL);

As documented in books online for previous versions of SQL Server the identity property does not guarantee the absence of gaps, this statement remains true for the above workarounds. These solutions do help with removing the gaps that occur as part of restarting the instance in SQL Server 2012.

Best regards
Vishal


https://connect.microsoft.com/SQLServer/feedback/details/739013/failover-or-restart-results-in-reseed-of-identity


재현 안됨

Microsoft SQL Server 2012 - 11.0.2100.60 (X64) 

Feb 10 2012 19:39:15 

Copyright (c) Microsoft Corporation

Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)



재현됨

Microsoft SQL Server 2012 (SP1) - 11.0.3128.0 (X64) 

Dec 28 2012 20:23:12 

Copyright (c) Microsoft Corporation

Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)


- powered by 심규현, 안인옥, 추숙, 차주언, 성치훈-

Posted by 보미아빠
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함