이것들은 데이터베이스 페이지 및 저장 프로시져와 같이 로드할 수 있는 디스크의 객체입니다. 따라서 SQL Server가 메모리 사용량을 기준으로 이러한 객체를 늘리거나 줄일 수 있습니다. 캐시에는 버퍼 풀과 계획 캐시가 포함됩니다.
고정 메모리
고정 메모리는 증가하거나 축소될 수 있습니다. 사용하지 않을 때만 축소됩니다. 예를 들어 연결 수가 감소하거나 실행 중인 쿼리 수가 감소하는 경우가 여기에 해당합니다.
이는 캐시와 다릅니다. 고정 메모리가 부족하면 SQL Server 메모리가 부족해질 수 있습니다.
고정 메모리에는 연결 메모리와 메모리 부여가 포함됩니다.
SQL Server 오버헤드
SQL Server 오버헤드에는 스레드와 스택이 포함됩니다.
인메모리 OLTP
인메모리 OLTP에는 인메모리 테이블과 인메모리 파일 그룹이 포함됩니다.
SQL Server 메모리 사용량은 maximum server memory 및 memory.memory.limitmb 설정을 통해 제어됩니다. Cloud SQL은 memory.memory.limitmb 매개변수를 자동으로 설정합니다.
memory.memory.limitmb에 대한 자세한 내용은 Microsoft 문서를 참조하세요.
Page life expectancy는 가장 오래된 페이지가 버퍼 풀에 머무는 시간(초)로 나타냅니다.
이 값은 Microsoft에서 권장하는 300보다 커야 합니다. 지속적으로 300 미만이면 인스턴스의 메모리 사용률이 높은 것일 수 있습니다.
다음 쿼리를 실행하여 Page life expectancy를 모니터링하세요.
SELECT
[object_name],
[counter_name],
[cntr_value]FROM
sys.dm_os_performance_counters
WHERE
[object_name]LIKE
'%Manager%'AND
[counter_name]='Page life expectancy'
Memory Grants Pending 플래그를 확인합니다.
Memory Grants Pending은 작업공간 메모리 부여를 기다리는 총 프로세스 수를 지정합니다.
다음 쿼리를 실행하여 Memory Grants Pending을 확인합니다. 이 쿼리에서 권한 부여가 계속해서 대기 중으로 표시되면 메모리 사용률이 높은 것입니다. 데이터베이스 대기를 쿼리하고 메모리에서 대기 중인 문을 조정하여 사용률을 줄일 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-19(UTC)"],[],[],null,["# Optimize high memory usage in instances\n\n\u003cbr /\u003e\n\n[MySQL](/sql/docs/mysql/optimize-high-memory-usage \"View this page for the MySQL database engine\") \\| [PostgreSQL](/sql/docs/postgres/optimize-high-memory-usage \"View this page for the PostgreSQL database engine\") \\| SQL Server\n\n\u003cbr /\u003e\n\nThis document explains how to review and optimize a Cloud SQL for SQL Server instance if that instance is identified\nby the underprovisioned instance recommender as having high memory consumption.\n\nSQL Server memory\n-----------------\n\nSQL Server memory can be divided into the following:\n\n- [Caches](/sql/docs/sqlserver/optimize-high-memory-usage#cache)\n- [Fixed memory](/sql/docs/sqlserver/optimize-high-memory-usage#fixed-memory)\n- [SQL Server overhead](/sql/docs/sqlserver/optimize-high-memory-usage#sql-server-overhead)\n- [In-Memory online transactional processing (OLTP)](/sql/docs/sqlserver/optimize-high-memory-usage#oltp)\n\n### Caches\n\nThese are objects on a disk that can be reloaded, such as database pages and stored procedures. As a result,\nthe SQL Server can grow and shrink these objects based on memory utilization. Caches include buffer pools and plan caches.\n\n### Fixed memory\n\nFixed memory can grow and shrink. It only shrinks when not in use; for example, when the number of connections drops or the number of queries executing decreases.\nIt's different from caches. If there is not enough fixed memory, SQL Server can run out of memory.\nFixed memory includes connection memory and memory grants.\n\n### SQL Server overhead\n\nSQL Server overhead includes threads and stacks.\n\n### In-Memory OLTP\n\nIn-Memory OLTP includes In-Memory tables and In-Memory filegroups.\n\nThe memory consumption by SQL Server is controlled by setting `maximum server memory` and `memory.memory.limitmb`. The `memory.memory.limitmb` parameter is set by Cloud SQL automatically.\n\nTo learn more about `memory.memory.limitmb`, see the [Microsoft documentation](https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-configure-mssql-conf?view=sql-server-ver16#memorylimit).\n\nMemory optimization options\n---------------------------\n\nTo determine if an instance needs more memory tuning, do the following:\n\n- [Check the value of the `max server memory (mb)`](/sql/docs/sqlserver/flags#special-flags) flag.\n\n We recommend you let Cloud SQL manage the value of this flag.\n If you must manually manage this value, use the `max_server_memory (mb)`\n usage formula outlined on [Best practices](/sql/docs/sqlserver/best-practices#sqlserver_settings)\n to help prevent SQL Server from consuming all memory.\n\n For more information, see [Special flags](/sql/docs/sqlserver/flags#special-flags).\n- Monitor the `Page life expectancy` flag.\n\n `Page life expectancy` indicates the amount of time, in seconds, that the oldest page stays in the buffer pool.\n This value should be more than 300 as recommended by Microsoft. If it consistently falls under\n 300, it could be an indication that the instance is facing high memory utilization.\n Run the following query to monitor `Page life expectancy`. \n\n ```bash\n SELECT\n [object_name],\n [counter_name],\n [cntr_value]\n FROM\n sys.dm_os_performance_counters\n WHERE\n [object_name]\n LIKE\n '%Manager%'\n AND\n [counter_name] = 'Page life expectancy'\n \n ```\n- Check the `Memory Grants Pending` flag.\n\n `Memory Grants Pending` specifies the total number of processes waiting for a workspace memory grant.\n Run the following query to check `Memory Grants Pending`. If this query consistently shows grants pending,\n then it indicates high memory utilization. You can reduce it by querying the database\n waits and tuning any statement that's waiting on memory. \n\n ```bash\n SELECT\n @@SERVERNAME AS [Server Name],\n RTRIM([object_name]) AS [Object Name],\n cntr_value AS [Memory Grants Pending]\n FROM\n sys.dm_os_performance_counters WITH(NOLOCK)\n WHERE\n [object_name]\n LIKE\n N'%Memory Manager%' -- Handles named instances\n AND\n counter_name = N'Memory Grants Pending'\n \n ```\n\nWhat's next\n-----------\n\n- [Google Cloud recommenders](/recommender/docs/recommenders)"]]