SQL Server 2017 – Increased Memory, Do I Need to Change Page-File Size?

memorysql serversql-server-2017windows-server

I'm running SQL Server 2017 on Windows Server 2012 R2 and have increased the memory from 256 GB to 512 GB.
I've noticed the following configuration for Virtual Memory:

  • C: [OS] = 2 GB
  • G: [DATA] = None
  • H: [LOGS] = None
  • T: [TEMP] = None

There is a lot of advice out there talking about setting the size to 1.5 or 2 times the size of the memory that is installed. Am I reading this correct or have I misread the articles and they apply to something else?

There is also articles suggesting not to worry about the virtual memory as SQL should only be using RAM and not virtual memory, and the OS only requires 2GB of virtual memory?

Best Answer

I believe the 2x size of RAM recommendation is outdated and unrealistic. If a server only has 32 GB of RAM it might make sense, but it's a waste of expensive disk space to make it 2x on a system that had a massive amount of memory.

There are two primary purposes of the pagefile:

  • To use as a swap file for memory. If SQL Server and other applications are configured correctly to limit the amount of memory available, it will never be needed for this purpose. If the system does have to use the pagefile to swap memory, system performance will be so bad you'll effectively have an outage and be forced to deal with it immediately. So if you configure a 1 TB pagefile, it won't help performance when the system starts swapping to disk and you'll be forced to do something about it before it needs to swap even 100 GB.

  • To hold a memory dump if the system crashes (on the volume where OS is installed). Again, if a server only has 32 GB of RAM, it makes sense to configure it to do a full memory dump if the system crashes. However, it is rarely necessary for diagnostics purposes to need a full memory dump, anda kernel memory dump is the reasonable choice on a system that has a lot of memory. Also, Windows crashes are much less frequent these days than in 1996 (or whenever) when that 2x recommendation was made. Also, if the system crashes and you get a 1 TB memory dump (you'll need another TB free on c: for it), good luck zipping that sucker and transferring it to Microsoft. I would only configure for a kernel dump and only change that if the system is crashing and Microsoft needs a full memory dump to diagnose the issue.

So if you're super paranoid (which is certainly justified in some situations) and have 2 TB to allocate that will likely never be used, then a gigantic pagefile is a consideration. However, it's rarely going to be really necessary.

So my answer is that you are highly unlikely to need to increase the pagefile size. It probably hasn't been used at the current size, and with more memory now, it's even less likely to be used, so it would follow that there's no need to waste more disk space on a bigger one.