• Pricing
  • Performance
  • About Us
PricingPerformanceAbout Us
Sign InSign Up
  • Pricing
  • Performance
  • About Us
PricingPerformanceAbout Us
Sign InSign Up
Sign InGet Started

High-Performance Cloud Infrastructure

Empowering businesses with enterprise-grade cloud solutions at competitive prices. Built for reliability and simplicity. Designed for growth.

SOC 2 Compliant
ISO 27001
99.9% Uptime

Stay Updated

3000+

Customers

15,000+

VMs Deployed

24/7

Human Support

Products

Build

  • Raff VM
  • Raff Windows VM
  • Raff Apps
  • Kubernetes

Templates

  • Linux VM
  • Forex VM
  • n8n VM

Store

  • Raff S3
  • Raff Databases

Support

  • Documentation
  • API Reference
  • CLI
  • Terraform Provider
  • Contact
  • FAQ
  • Status

Company

  • About
  • Pricing
  • Blog
  • Release Notes
  • Performance
  • Status

Account

  • Sign In
  • Sign Up
  • Reset Password

Legal

  • Terms of Service
  • Privacy Policy
  • Service Level Agreement
  • Acceptable Use Policy

© 2026 Raff Technologies. All rights reserved.

System Status
SQL Server & Databases
SQL Server & Databasesintermediate9 min read·Updated May 26, 2026

MSSQL Memory Tuning on a Windows VPS: Set Max Server Memory Safely

Learn how to set SQL Server max server memory on a Windows VPS, reserve RAM for Windows, and verify the setting with sqlcmd.

Aybars Altınyay
Aybars Altınyay
Platform Engineer & Technical Writer
Genuine, fully-licensed Windows
Spin up a Windows Server: full admin, RDP-ready
Genuine Windows Server 2019, 2022, or 2025 with full administrator access. We handle the Microsoft licensing, billed monthly with nothing to buy upfront.
Deploy Windows NowLearn MoreTalk to Windows Engineer
sqlcmd output verifying SQL Server max server memory is set to 4096 MB on a Raff Windows VPS.

In short

SQL Server can use a large amount of memory by design. On a Windows VPS, that is good for database performance, but dangerous if SQL Server is allowed to compete with Windows, RDP sessions, IIS, backup tools, or other business apps. Set a safe max server memory (MB) value, leave enough RAM for the operating system, then verify the setting with sp_configure and monitor actual SQL Server process memory.

Quick verdict

SituationRecommended action
SQL Server is the main workload on the VPSSet max server memory and leave RAM for Windows
SQL Server shares the VPS with IIS, RDP users, or appsReserve more memory for non-SQL workloads
Small SQL Server Express test VMUse the same commands, but remember Express has edition limits
Windows feels slow after SQL Server installCheck SQL Server memory cap first
RDP becomes laggy while SQL is runningCheck CPU/RAM baseline and SQL process memory
Production Standard or Enterprise workloadTune memory more carefully and monitor over time

The goal is not to starve SQL Server. The goal is to stop SQL Server from starving Windows and the other workloads on the VPS.

Why SQL Server uses so much memory

SQL Server uses memory aggressively because memory makes databases faster.

It uses RAM for:

  • Data page cache
  • Query plan cache
  • Sorts and hash operations
  • Locks and connections
  • Columnstore and in-memory features, where used
  • Internal engine operations

By default, SQL Server may be allowed to use a very high amount of memory. On a dedicated database server, that can be acceptable if the server is sized correctly. On a VPS that also runs RDP sessions, IIS, backup jobs, monitoring tools, or business apps, an uncapped SQL Server instance can make Windows feel slow.

Typical symptoms:

  • RDP desktop feels delayed
  • Windows starts paging to disk
  • Other services slow down
  • Backup jobs take longer
  • SQL Server itself becomes inconsistent under memory pressure
  • Users report that the server “freezes” during business hours

A safe memory cap prevents SQL Server from taking RAM that Windows and other workloads need.

What we tested on Raff

We tested the memory checks and configuration commands on a Raff Windows VPS running Windows Server 2025 Datacenter Evaluation and SQL Server 2025 Express.

PowerShell output showing a Raff Windows VPS running Windows Server 2025 Datacenter Evaluation with SQL Server SQLEXPRESS service running.

Test environment:

ItemValue
ProviderRaff Technologies
OSWindows Server 2025 Datacenter Evaluation
SQL ServerSQL Server 2025 Express
InstanceSQLEXPRESS
VPS size4 vCPU / approximately 8 GB RAM
Test date2026-05-26
TesterAybars Altinyay

On this VM, we verified:

  • Windows Server and SQL Server service state
  • Total and free Windows memory
  • Current SQL Server memory configuration
  • SQL Server process memory usage
  • Setting max server memory (MB)
  • Verifying the new memory cap

We tested with SQL Server Express. Production memory tuning is often more important on SQL Server Standard and Enterprise, where larger workloads and higher memory usage are common.

SQL Server Express note

SQL Server Express is useful for testing and small workloads, but it has edition limits. That means Express may not behave like a larger Standard or Enterprise production instance.

Still, Express is useful for demonstrating the tuning workflow:

  1. Check Windows RAM.
  2. Check SQL Server memory configuration.
  3. Check SQL Server process memory.
  4. Set max server memory.
  5. Verify the setting.

For production workloads, always confirm the SQL Server edition, workload size, and memory requirements before choosing the final value.

Step 1 - Check total and free Windows memory

Before changing SQL Server settings, check how much memory the VPS has and how much is free.

Run PowerShell as Administrator:

Powershell
$os = Get-CimInstance Win32_OperatingSystem [PSCustomObject]@{ TotalRAM_GB = [math]::Round($os.TotalVisibleMemorySize / 1MB, 2) FreeRAM_GB = [math]::Round($os.FreePhysicalMemory / 1MB, 2) }

PowerShell output showing total and free Windows memory on a Raff Windows VPS before SQL Server memory tuning.

This tells you whether the operating system already has enough headroom.

If free memory is already low before SQL Server is under load, do not simply increase the SQL Server memory cap. Investigate what else is using RAM or resize the VPS.

Step 2 - Check current SQL Server memory configuration

Use sp_configure to check the current SQL Server memory settings.

For the SQLEXPRESS instance, run:

Powershell
sqlcmd -S localhost\SQLEXPRESS -E -C -Q "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'max server memory (MB)'; EXEC sp_configure 'min server memory (MB)';"

sqlcmd output showing current SQL Server min server memory and max server memory configuration values.

The important setting is:

Text
max server memory (MB)

If the value is extremely high, SQL Server is effectively uncapped, subject to edition and workload behavior.

That is not ideal on a VPS that also needs memory for Windows, RDP, IIS, backup tools, or other services.

Step 3 - Check actual SQL Server process memory

The configuration value tells you what SQL Server is allowed to use. The process check tells you what it is using now.

Run:

Powershell
Get-Process | Where-Object {$_.ProcessName -like "sqlservr*"} | Select-Object ProcessName, Id, @{Name="WorkingSet_MB";Expression={[math]::Round($_.WorkingSet64/1MB,2)}}, @{Name="PrivateMemory_MB";Expression={[math]::Round($_.PrivateMemorySize64/1MB,2)}}

PowerShell output showing SQL Server process working set and private memory usage on a Windows VPS.

Use this together with Task Manager and SQL Server performance counters.

A low number on a test database does not mean SQL Server is tuned. It only means the current workload is small. Production databases can grow into the configured cap over time.

Don’t have a server yet?

Deploy Windows NowLearn MoreTalk to Windows Engineer

Step 4 - Choose a safe max server memory value

A practical starting point is to reserve memory for Windows first, then give SQL Server the rest.

For many SMB Windows VPS workloads:

Total VPS RAMSuggested SQL max memoryReserved for Windows and other services
4 GB1536-2048 MB2 GB or more
8 GB4096 MB4 GB
16 GB10240-12288 MB4-6 GB
32 GB24576-28672 MB4-8 GB
64 GB49152-56320 MB8-16 GB

Use more reservation when the same VPS also runs:

  • IIS
  • RDP users
  • QuickBooks or ERP clients
  • Backup tools
  • Monitoring agents
  • Antivirus scans
  • File services
  • Other database engines

Use less reservation only when the VM is a dedicated SQL Server and the workload has been tested.

For our approximately 8 GB test VPS, we used:

Text
4096 MB

That leaves around 4 GB for Windows and other processes.

Step 5 - Set max server memory

To set max server memory (MB) to 4096 MB on the test instance, run:

Powershell
sqlcmd -S localhost\SQLEXPRESS -E -C -Q "EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'max server memory (MB)', 4096; RECONFIGURE;"

sqlcmd output showing max server memory set to 4096 MB for SQL Server on a Windows VPS.

This change does not normally require a Windows reboot.

SQL Server adjusts memory usage over time. It does not always instantly release memory back to Windows at the exact moment you change the setting.

Step 6 - Verify the new memory cap

After setting the value, verify it:

Powershell
sqlcmd -S localhost\SQLEXPRESS -E -C -Q "EXEC sp_configure 'max server memory (MB)';"

Expected result:

Text
config_value run_value 4096 4096

sqlcmd output verifying max server memory is set to 4096 MB.

If config_value and run_value match, the setting is active.

What about min server memory?

min server memory (MB) is often misunderstood.

It does not mean SQL Server immediately takes that memory at startup. It means that once SQL Server has grown to that level, it tries not to release memory below that amount.

For many SMB VPS workloads, you can leave min server memory at the default unless you have a specific reason to set it.

If you do set it, keep it much lower than max server memory.

Example for an 8 GB VPS:

SettingValue
Min server memory1024-2048 MB
Max server memory4096 MB

Avoid setting min equal to max unless the VPS is dedicated to SQL Server and you understand the tradeoff.

Dedicated SQL Server vs shared VPS

Memory settings depend on what else runs on the same VPS.

Dedicated SQL Server VPS

If the VPS runs only SQL Server, you can give SQL Server most of the memory while leaving enough for Windows.

Example:

VPS RAMSQL max memory
16 GB12288 MB
32 GB28672 MB
64 GB56320 MB

Shared Windows VPS

If the VPS also runs IIS, RDP users, file shares, business apps, or backup tools, reserve more memory outside SQL Server.

Example:

VPS RAMSQL max memory
8 GB3072-4096 MB
16 GB8192-10240 MB
32 GB20480-24576 MB

RDS or multi-user desktop VPS

If users also log into the server through RDP or RDS Session Host, be conservative. Desktop sessions, Office apps, browsers, QuickBooks, ERP clients, and other tools all need RAM.

In that case, SQL Server should not be allowed to take nearly all available memory.

Monitor Page Life Expectancy

Page Life Expectancy, or PLE, is a useful SQL Server memory pressure signal.

Run:

Sql
SELECT cntr_value AS [Page Life Expectancy (seconds)] FROM sys.dm_os_performance_counters WHERE counter_name = 'Page life expectancy' AND object_name LIKE '%Buffer Manager%';

General interpretation:

PLE valueMeaning
Under 100Severe memory pressure
100-300Likely under-provisioned
300-1800May be acceptable depending on workload
Above 1800Generally healthier cache behavior

Do not judge from one number alone. Watch the trend.

A server that starts the day at 5000 seconds and drops to 150 seconds every afternoon may be running out of cache for the real workload.

Monitor buffer cache hit ratio

Buffer cache hit ratio can show whether SQL Server is reading too often from disk instead of memory.

Run:

Sql
SELECT (a.cntr_value * 1.0 / b.cntr_value) * 100 AS BufferCacheHitRatio FROM sys.dm_os_performance_counters a JOIN sys.dm_os_performance_counters b ON a.object_name = b.object_name WHERE a.counter_name = 'Buffer cache hit ratio' AND b.counter_name = 'Buffer cache hit ratio base';

For many OLTP workloads, a high cache hit ratio is expected.

If the value is consistently low, SQL Server may not have enough memory for the active working set, or queries may be scanning too much data.

Lock Pages in Memory

Lock Pages in Memory, often called LPIM, allows SQL Server to keep important memory pages from being paged out by Windows.

This can help production SQL Server workloads, but it should be applied carefully.

To configure it:

  1. Open secpol.msc.
  2. Go to Local Policies.
  3. Open User Rights Assignment.
  4. Find Lock pages in memory.
  5. Add the SQL Server service account.
  6. Restart the SQL Server service.

For SQL Server Express test systems, LPIM is usually not the first priority.

For production Standard or Enterprise workloads, review Microsoft guidance and test carefully before enabling it.

Workload-specific guidance

OLTP databases

For transaction-heavy applications, memory pressure affects response time quickly.

Recommendations:

  • Set max server memory.
  • Monitor PLE over time.
  • Keep enough RAM for Windows.
  • Avoid running heavy reports on the same instance during business hours.
  • Watch query plans and indexes, not only memory.

Reporting databases

Reporting queries can scan large amounts of data.

Recommendations:

  • Give SQL Server more memory if the VPS is dedicated.
  • Schedule reports outside business hours.
  • Consider indexing and query tuning.
  • Avoid mixing heavy reporting and transactional workloads on a tiny VPS.

SQL Server plus IIS

If SQL Server and IIS share the same VPS, reserve memory for the web application.

Recommendations:

  • Do not give SQL Server nearly all RAM.
  • Monitor IIS worker process memory.
  • Watch both SQL and application logs.
  • Consider separating SQL and web workloads as traffic grows.

SQL Server plus RDP users

If users work on the same server through RDP, leave memory for their sessions.

Recommendations:

  • Reserve more RAM for Windows and users.
  • Watch browser and Office memory use.
  • Avoid setting SQL max too high.
  • Consider a larger VPS or separating database and desktop workloads.

Common mistakes

Leaving max server memory unlimited

This is the most common mistake. SQL Server may grow until Windows and other services have too little memory.

Setting max server memory equal to total VPS RAM

This leaves no space for Windows. Always reserve memory for the operating system and other services.

Setting min server memory too high

A high minimum can prevent SQL Server from releasing memory when other workloads need it.

Ignoring what else runs on the VPS

A dedicated SQL Server and a shared RDP/IIS/SQL server need different memory settings.

Treating one PLE value as final truth

PLE should be monitored over time. One snapshot does not tell the whole story.

Forgetting SQL Server Express limits

Express is useful for testing and small apps, but production sizing guidance is more important on Standard and Enterprise workloads.

What Raff recommends

For SQL Server on a Windows VPS, Raff recommends:

  1. Check total RAM and free RAM first.
  2. Check SQL Server process memory.
  3. Set max server memory.
  4. Leave enough RAM for Windows and other apps.
  5. Use a larger reservation when SQL shares the VPS with IIS, RDP, or business software.
  6. Monitor Page Life Expectancy and process memory over time.
  7. Resize the VPS if the working set is larger than the plan.

For an 8 GB Windows VPS, 4096 MB is a reasonable lab value and a common starting point for a shared small SQL workload. Production values should be adjusted based on workload behavior.

Tested on

Tested on Raff Windows VPS, Windows Server 2025 Datacenter Evaluation, SQL Server 2025 Express, SQLEXPRESS instance, approximately 8 GB RAM, 2026-05-26. We verified Windows memory baseline, current SQL Server memory configuration, SQL Server process memory usage, setting max server memory to 4096 MB, and verifying the new memory cap. Tester: Aybars Altinyay

What's next

  • MSSQL Backup Strategy on a Windows VPS - build full, differential, and log backup routines
  • Install MSSQL Server 2025 on a Windows VPS - install and prepare SQL Server on Raff
  • RDP Performance Tuning for Windows VPS - improve remote desktop responsiveness
  • Windows Server Hardening Checklist - secure a Windows Server VPS before production
  • Raff Windows VPS - deploy a Windows Server VPS for SQL Server, IIS, business apps, and remote administration

Sources

  • Microsoft Learn - Server memory configuration options
  • Microsoft Learn - Enable the Lock Pages in Memory option
  • Microsoft Learn - Monitor memory usage
  • Microsoft Learn - SQL Server editions and supported features
  • Date last verified: 2026-05-26
Was this article helpful?

Published May 26, 2026 · Updated May 26, 2026

Back to hub
Get started
Deploy a Windows Server

Genuine, fully-licensed Windows. Full admin, RDP-ready in ~55 seconds.

Deploy Windows Now
Full admin · RDP-ready · 14-day money-back
On this page
In shortQuick verdictWhy SQL Server uses so much memoryWhat we tested on RaffSQL Server Express noteStep 1 - Check total and free Windows memoryStep 2 - Check current SQL Server memory configurationStep 3 - Check actual SQL Server process memoryStep 4 - Choose a safe max server memory valueStep 5 - Set max server memoryStep 6 - Verify the new memory capWhat about min server memory?Dedicated SQL Server vs shared VPSMonitor Page Life ExpectancyMonitor buffer cache hit ratioLock Pages in MemoryWorkload-specific guidanceCommon mistakesWhat Raff recommendsTested onWhat's nextSources
Ready when you are

Your Windows Server, live in ~55 seconds

Genuine, fully-licensed Windows with full admin and RDP. We handle the Microsoft licensing, billed monthly with nothing upfront. On NVMe SSD, backed by a 14-day money-back guarantee.

Deploy Windows Now
Learn MoreTalk to Windows Engineer

Related articles

SQL Server & DatabasesAlways On Availability Groups on Two Windows VPSesLearn how to plan and set up SQL Server Always On availability groups on Windows Server VPS infrastructure, including WSFC, SQL editions, replicas, listener, quorum, seeding, failover tests, backups, and common mistakes.10 min read7/6/2026SQL Server & DatabasesConfigure TempDB for MSSQL Performance on a Windows VPSEliminate TempDB allocation contention with multiple equal-sized data files. Min(8, vCPU) files, fixed autogrowth, optional separate disk.8 min read5/29/2026SQL Server & DatabasesMSSQL Standard vs Enterprise — When to Pay MoreCompare SQL Server Standard and Enterprise for Windows VPS workloads, including SQL Server 2025 limits, licensing, high availability, and when Enterprise is worth paying for.8 min read5/29/2026