max server memory (MB)
Upper limit on the memory SQL Server's memory manager takes, buffer pool included.
- 預設
2147483647- Range
- 128 to 2147483647 MB
- Restart needed
- 否
- Default checked on
- SQL Server 2025
其作用
Covers the buffer pool, plan cache, memory grants and most other memory clerks. Thread stacks and some allocations made by DLLs and linked server providers sit outside it, so the process can use somewhat more. On Linux, mssql-conf memory.memorylimitmb (80% of physical RAM by default) is an outer limit as well.
預設值
2147483647. 2147483647, effectively unlimited (SQL Server 2025).
Check the current value
SELECT name, value, value_in_use, minimum, maximum, is_dynamic, is_advanced FROM sys.configurations WHERE name = 'max server memory (MB)'; -- EXEC sp_configure 'max server memory (MB)'; also works, but only while show advanced options is 1; -- otherwise it fails with Msg 15123 because this is an advanced option.
Change it
EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'max server memory (MB)', 57344; RECONFIGURE;
No restart: it takes effect when RECONFIGURE runs (sys.configurations.is_dynamic = 1). It is an advanced option, so show advanced options must be on to change it.
When to change it
On every production server. Leave the OS and other processes room: a common starting point is total RAM minus 10% or 4GB, whichever is larger, then watch Available MBytes.
What can go wrong
Left at the default, SQL Server can take memory until the OS pages it out. Set too low, the buffer pool shrinks and reads go to disk.
The closest setting on other engines
| 引擎 | 設定 | 預設 | Restart |
|---|---|---|---|
| SQL Server |
max server memory (MB) this page
|
2147483647 |
否 |
| PostgreSQL |
shared_buffers
|
128MB |
是 |
| MySQL |
innodb_buffer_pool_size
|
128MB |
否 |
| Oracle |
sga_target
|
0 |
否 |
| SQLite |
cache_size
|
-2000 (about 2MB) |
否 |
Questions about max server memory (MB)
What is the default value of max server memory (MB) in SQL Server?
2147483647. 2147483647, effectively unlimited (SQL Server 2025).
Does changing max server memory (MB) require a restart?
No. No restart: it takes effect when RECONFIGURE runs (sys.configurations.is_dynamic = 1). It is an advanced option, so show advanced options must be on to change it.
When should I change max server memory (MB)?
On every production server. Leave the OS and other processes room: a common starting point is total RAM minus 10% or 4GB, whichever is larger, then watch Available MBytes.
Back to all SQL Server settings, or check the SQL Server manual for every option.
Check max server memory (MB) on your own server
SQLly runs the query above against SQL Server and the other engines in this reference, from one desktop app on macOS, Windows and Linux.