Tech Blog

IT Administration, Software, Technology

Microsoft SQL Server and its RAM consumption

By Pranay Choudhary4 min read
← Back to blog

SQL Server manages its memory requirements dynamically. Meaning, SQL Server will consume as much memory as available.

In other words, if you have deployed SQL Server on a machine with 4GB RAM, SQL Server will consume all the RAM available in the system, gradually. However, if you upgrade the same machine to 8GB RAM, SQL Server will consume the additional RAM and exhaust the complete 8GB.

So, how do you determine if your SQL Server really needs more RAM? How much RAM will SQL Server need? How much memory is normal for SQL Servers? Is SQL Server really lacking memory? How do I prove that SQL server needs more memory? How to identify SQL Server’s memory bottlenecks?

You might encounter such questions while troubleshooting performance issues due to SQL Server in production. The memory requirement for SQL Server purely depends on your database schema, your query structure and current load.

Performance Counter

Performance counters are the best way to monitor your SQL server internal metrics. In this blog, I will list down some important and some not-so-important performance counters that can be used to identify memory or performance issues in SQL server

SQL Server: Buffer Manager – Page Life Expectancy

Page Life Expectancy is probably the most important performance counter to consider here. It represents the number of seconds a page will stay in cache. Higher this value, the better SQL Server will perform. Lower values means high IO operations, which points out that you need more RAM for the cache. For good performance this value should be above 300 in a machine with 4 GB RAM.

SQLServer: Memory Manager – Memory Grants Pending

Memory Grants Pending is the next most important performance counter to consider here. It represents the total number of SQL processes or SQL queries that are waiting for memory to be granted. Lower this value, the better SQL Server will perform. For best performance, this value should be 0 most of the times. Consistent value greater than 1 demotes memory shortage.

SQL Server: Buffer Manager – Buffer Cache Hit Ratio

Buffer Cache Hit Ratio represents the percentage of times the page was found in cache. Higher this value, the better SQL server will perform. Lower values means high IO operations, which points out that you need more RAM for the cache. For good performance this value should be 98 or above. If the value is less than 90, the SQL server is under memory stress.

SQLServer: General Statistics – Processes blocked

“Processes blocked” is not directly related to SQL Server’s memory, but it is worth mentioning because it is the most useful performance counter to detect performance issues in SQL Server. It represents the total number of processes that are blocked. The processes can be blocked due to a SQL lock, memory shortage, IO throttling or various other reasons. Lower the value, the better your SQL queries will perform. Ideal value for this counter is 0.

Summary of Counters (with additional useful counters)

Performance CounterTrendExpected Value for Best PerformanceExplanation
SQLServer:Buffer Manager\Page life expectancyHigher is better> 75 * [System RAM in GiB]Sudden drop in values are Ok
SQLServer:Memory Manager\Memory Grants PendingLower is better0Consistent value of 2 or higher means more RAM is needed
SQLServer:Buffer Manager\Buffer cache hit ratioHigher is better> 98%< 90 means add more RAM
Memory\Pages/secLower is better< 50You can ignore this value during backup or restoration.
Paging File(_Total)\% UsageLower is better< 50> 60% indicates external memory pressure
Memory\Page Faults/secLower is better< 50High value means other processes might be affecting SQL server performance
Process(sqlservr)\Page Faults/secLower is better< 50High value represents excessive paging in SQL Server
SQLServer:Memory Manager\Total Server Memory (KB)Close to Target Server Memory~ Target Server MemoryLarge difference means you have either allocated too much or too less RAM
Memory\Available MBytesHigher is better> 200 MBLow value means other processes might be affecting SQL server performance
SQLServer:Buffer Manager\Lazy writes/secLower is better< 20High value represents many dirty pages are flushed from buffer pool to disk, meaning low buffer space
Free List Stalls/secLower is better0Value more than 3 represents requests being suspended due to low buffer
SQLServer:Buffer Node(xxx)\Page life expectancyHigher is better> 75 * [Node’s RAM in GiB]Same as Buffer Manager\Page life expectancy, but for SQL Server with multiple NUMA nodes
SQLServer:General Statistics\Processes blockedLower is better0High value represents too many queries are blocked to acquire additional resources.
SQLServer:SQL Statistics\SQL Compilations/secLower is better< 20% of Batch Requests/secHigh value represents too many ad hoc queries
SQLServer:Buffer Manager\Page lookups/secLower is better< 50Value more than 100 represents too many ad hoc queries and insufficient execution plans
That’s all folks

Perfmon View

Sample view of performance counters on a SQL Server machine:

To learn more about setting up performance counter monitor on Windows Server machine, read this blog: https://www.mssqltips.com/sqlservertip/6933/windows-performance-monitor-sql-server-introduction/

Happy Troubleshooting SQL Servers!

Keep reading

You may be interested in

Browse all articles →
Using SCEP Certificates with Okta and SureMDM for Zero Trust Security
August 5, 20257 min read

Using SCEP Certificates with Okta and SureMDM for Zero Trust Security

For businesses embracing zero-trust principles, secure certificate-based authentication isn’t just nice to have—it’s a necessity. With Okta as your Identity Provider (IdP) and SureMDM as your unified endpoint management solution, you can now seamlessly distribute and manage device certificates using Simple Certificate Enrollment Protocol (SCEP). This blog will guide you through: Why Use SCEP with […]

By Sunny KumarRead More →
Celebrating Christmas – 42Gears Way
December 21, 20223 min read

Celebrating Christmas – 42Gears Way

One fun activity that everyone, from children to adults, loves to do is set up a Christmas tree – decorated with lights and ornaments. Every year, we love setting up a Christmas tree with decorative lights in our office. We, however, like to add a touch of our own technology to this experience. This year […]

By Onkar SinghRead More →
How Angular is Different from AngularJS
September 27, 20227 min read

How Angular is Different from AngularJS

What is Angular? Angular is a popular open-source Typescript framework and free to use. Considered to be a JavaScript-based framework,TypeScript.is its primary programming language. TypeScript is Developed by Microsoft and its superset of JavaScript, which simply means that TypeScript has all the capabilities that JS has and more additional features. Angular is majorly used for […]

By Sachin DevadigaRead More →