MSSQL CPU 점유 성능 향상
2023. 7. 3. 09:48ㆍ웹개발
728x90
DB 서버의 CPU가 100프로를 찍을 때가 있어서 찾아보았다.
SQL SERVER 에서 최대 병렬 처리 관련해서 처리할수있다.
max degree of parallelism 옵션(MAXDOP) 을 쿼리에 적용 할 수 있고 데이터베이스에 옵션 설정을 할 수 있다.
USE AdventureWorks2012 ;
GO
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
EXEC sp_configure 'max degree of parallelism', 16;
GO
RECONFIGURE WITH OVERRIDE;
GO
위의 SQL은 데이터베이스 옵션을 변경 설정 하는것이다.
쿼리에서 옵션을 설정 할수도 있다.
USE AdventureWorks ;
GO
SELECT ProductID, OrderQty, SUM(LineTotal) AS Total
FROM Sales.SalesOrderDetail
WHERE UnitPrice < $5.00
GROUP BY ProductID, OrderQty
ORDER BY ProductID, OrderQty
OPTION (MAXDOP 2);
GO
병렬로 쿼리가 처리되지 않기를 바라면 max degree of parallelism 옵션(MAXDOP) 을 1로 설정하면 된다.
출처 : https://learn.microsoft.com/ko-kr/sql/t-sql/queries/hints-transact-sql-query?view=sql-server-ver16
https://learn.microsoft.com/ko-kr/sql/database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option?view=sql-server-ver16
728x90
반응형
'웹개발' 카테고리의 다른 글
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (0) | 2023.08.29 |
---|---|
MSSQL 인덱스 힌트 INDEX HINT (0) | 2023.08.01 |
MSSQL SQL SERVER 인덱스 성능 개선 (0) | 2023.07.14 |
SVN: '0x0040010b: Obtain Project Name' 오류 시 (0) | 2023.07.12 |
좌표 기반 폴리곤 안에 위치해 있는지 확인하는 자바스크립트 (0) | 2023.07.03 |