Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 SQL Server max and min memory

Author  Topic 

ranvir_2k
Posting Yak Master

180 Posts

Posted - 2011-05-11 : 16:48:29
How does Max and Minimum memory work in SQL Server?

For example if I set the minimum memory for SQL Server to 2GB and maximum memory to 10GB, does this mean that SQL Server will always take a minimum of 2GB of memory and if need be (due to the amount of processing) it can take up to 10GB?
Or does it mean that SQL Server will always take up 10GB of memory?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-05-11 : 16:52:05
It means it'll take up 2GB and then use the rest as needed up to 10GB. SQL Server is a memory hog though, so you'll likely see it using 10GB at most times.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ranvir_2k
Posting Yak Master

180 Posts

Posted - 2011-05-11 : 16:55:41
Thanks for the reply. How can I see exactly how much memory SQL Server is using?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-05-11 : 17:26:46
Task Manager will show it on 32-bit systems, PerfMon will show it for 64-bit systems.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ranvir_2k
Posting Yak Master

180 Posts

Posted - 2011-05-11 : 17:39:47
Do you know which counter I should use in PerfMon?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-05-11 : 17:48:09
MSSQL$InstanceName\Memory Manager\Total Server Memory

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

ranvir_2k
Posting Yak Master

180 Posts

Posted - 2011-05-11 : 18:25:12
Many thanks for your help Tara, it's much appreciated.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-05-11 : 18:26:02
The minimum is not the amount that SQL will allocate on startup. That was true in SQL 2000, not any longer. It's the amount that, once it has allocated, it will not drop below. So, if you set a min of 2GB, SQL has 4GB allocated and the OS says 'reduce your memory usage', SQL will reduce to a minimum of 2GB.

Both numbers apply to the buffer pool alone, there is additional memory that SQL will take above and beyond the buffer pool.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2011-05-11 : 19:22:25
Another way to get the performance counters, instead of using perfmon:

Select *
,dopc.cntr_value / 1024 As 'Total (MB)'
From sys.dm_os_performance_counters dopc
Where dopc.counter_name In ('Target Server Memory (KB)', 'Total Server Memory (KB)')

Jeff
Go to Top of Page

ranvir_2k
Posting Yak Master

180 Posts

Posted - 2011-05-12 : 05:33:12
So SQL Server will always allocate the maximum configured memory when possible?
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-05-12 : 06:28:13
No. SQL will allocate the memory it needs, up to the max memory setting. There's a good chance it'll allocate all it's allowed to, but not always.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

ranvir_2k
Posting Yak Master

180 Posts

Posted - 2011-05-12 : 06:41:14
If the performance counter MSSQL$InstanceName\Memory Manager\Total Server Memory
is showing as 100% does that mean the maximum configured SQL Server memory has been allocated?
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-05-12 : 10:16:59
Total server memory is not a %. It's the amount of memory. I believe it's measured in MB.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2011-05-12 : 10:39:23
i think MSSQL$InstanceName\Memory Manager\Total Server Memory shows memory in KB with a scale 0.0001

--------------------------
http://connectsql.blogspot.com/
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-05-12 : 11:39:45
Yes KB. It's actually in the name too, I just left it off: MSSQL$InstanceName\Memory Manager\Total Server Memory (KB)

quote:
Originally posted by ranvir_2k

If the performance counter MSSQL$InstanceName\Memory Manager\Total Server Memory
is showing as 100% does that mean the maximum configured SQL Server memory has been allocated?



If you are seeing it use the maximum size in KB, then yes it is fully allocated. You'll almost always find SQL Server using the max. Right after a restart, it won't be, but it'll get there in a few hours usually.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -