Difference Between Virtual memory and Page File in SQL Server?

Chirag Sachdeva 281 Reputation points
2025-03-23T09:09:09.04+00:00

Hi there,

In On Prem SQL Server with 4gb server memory and page file size 4206 MB.

I ran DBCC memorystatus command and got below outputMemory Status

Page file SS

https://learn.microsoft.com/en-us/troubleshoot/sql/database-engine/performance/dbcc-memorystatus-monitor-memory-usage

As per above link,

Available Virtual Memory is that This value shows the overall amount of free virtual memory for SQL Server process.

Available Paging File is that This value shows the free paging file space.

I had this understanding that page file acts as virtual memory for sql server, but values in above screenshot does not make sense as available virtual memory is showing values in TBs. Now I have this doubt if there is any difference between virtual memory and page file. Also why the size of virtual memory is in TBs?

SQL Server Database Engine
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2025-03-23T11:06:23.33+00:00

    To be honest, I don't know that what Available virtual memory refers to. But it could be the total adressable memory space.

    What I do know is that it is not particularly interesting. You only want SQL Server to use physical memory. The main usage for memory in SQL Server is the buffer cache. That is, it reads pages from disk and saves them into memory so that future access to these pages will be faster, when they don't have to be read from disk.

    If the buffer cache spills to the page file, that complete negates the purpose of it, so you never want that to happen.


  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2025-03-24T18:17:39.9133333+00:00

    Virtual memory and paging are what allows computers to run programs that use more memory than is physically in the machine. paging allows program memory to be written to disk, and to allow required memory pages to loaded in memory. the disk file is the paging file(s). So in effect the size of the paging file is max size of virtual memory.

    So available memory is how much real memory the computer has and available virtual memory is basically the page file size. Virtual memory is shared with all processes, so a single process can not use all of it.

    The working set size is how many in memory pages are allocated to a process (though if there is low memory demand, it can borrow above this size). Unless the process can borrow, to load a new page, another page of the process must be paged out.

    SQLSever wants to manages its own memory and performs its own paging, so it wants the all of its pages in memory. if its cache is paged out, the point of the cache is lost. So sqlserver wants to use less than physical memory so it does not page. That is, its wants its working set size to be large enough to hold all of it data caches. The percent of committed memory in WS is a measurement of this. In your sample 88% of sqlserver process memory is in real memory.

    note: there is also pinned memory, which are virtual pages not allowed to be paged, and thus reduce the available pages for working sets.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.