Sql-server – SQL Server 2008 R2 memory issue

memorysql serversql-server-2008-r2

I have read many posts regarding the memory but still its not clear.

I have dedicated server SQL Server 2008 R2 with Windows 2008 R2, 32 GB RAM, 2 6 core processor and a database of around 60 GB on it. Min and Max amount is set to 16 GB and 28 GB.

After few days if I check in task manager, it shows the load of 31 GB Memory but actually maximum is allotted to SQL Server is 28 GB and nothing is running on he server.

Why its increasing to the maximum limit? And where this 31 GB used? If its used in cache then how to clear the cache without restarting the SQL Server?

There are different questions in my mind if someone can help and discuss on this.

Best Answer

Although you limited the memory to 28 GB out of 32 GB, this is not the only memory that SQL Server uses. The running programs and needs within Windows take some additional space.

If you want to closely tune the memory use, I recommend reading this, which works well for my servers. See Jonathan Kehayias at: http://www.sqlskills.com/blogs/jonathan/how-much-memory-does-my-sql-server-actually-need/

It basically says "reserve 1 GB of RAM for the OS, 1 GB for each 4 GB of RAM installed from 4–16 GB, and then 1 GB for every 8 GB RAM installed above 16 GB RAM." This suggests that your Maximum Memory should be tuned to 25 GB.

You can dynamically alter the min/max by setting a new value for those measures. The OS will adjust in a relatively short time without a reboot.

EDIT: Of course, as both Jonathan and Shanky mention, you still need to monitor your performance counters, since any general answer will likely need tuning.