SQL Server using 96% of memory

Chaitanya Kiran 801 Reputation points
2023-03-09T07:31:26.3866667+00:00

SQL Server is using 96% of memory from past 10 minutes. Can you please help me how to fix it.

SQL Server Other
{count} votes

2 answers

Sort by: Most helpful
  1. LiHongMSFT-4306 31,566 Reputation points
    2023-03-10T02:10:57.6866667+00:00

    Hi @Chaitanya Kiran

    SQL Server using 96% of memory. So, can I simply ignore? What if it consumes 99%?

    Refer to this article from Brent Ozar: A Sysadmin’s Guide to Microsoft SQL Server Memory.

    Task Manager doesn't always show correctly the memory eaten by SQL Server and its additional services. On 64-bit boxes, this number is somewhat more accurate, but on 32-bit boxes, it’s just completely off-base.

    For correct memory report, you could try this query or trust Performance Monitor to report memory, not Task Manager.

    SELECT DB_NAME(database_id) AS [Database Name],COUNT(*) * 8/1024.0 AS [Cached Size (MB)]
    FROM sys.dm_os_buffer_descriptors
    WHERE database_id > 4 -- system databases 
      AND database_id <> 32767 -- ResourceDB
    GROUP BY DB_NAME(database_id)
    ORDER BY [Cached Size (MB)] DESC OPTION (RECOMPILE);
    

    No matter how much memory you put in a system, SQL Server will use all it can get until it’s caching entire databases in memory and then some. If you’re going to run other software on the server, you can set SQL Server’s maximum amount of memory to leave memory free for other applications.

    Max Server memory = (Total Server memory – Memory for OS) – (Stack Size * max worker threads)

    Please refer to this article for more details: Min and Max memory configurations in SQL Server Database instances.

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Olaf Helper 47,436 Reputation points
    2023-03-09T08:17:52.9933333+00:00

    What to fix?
    It's by design that SQL Server uses as much memory as it's need and as it can get, see Memory management architecture guide

    You could only limit the max memory usage, see Server memory configuration options


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.