All Products
Search
Document Center

ApsaraDB RDS:View the memory usage of an ApsaraDB RDS for SQL Server instance

Last Updated:Mar 28, 2026

Run SQL queries against your RDS instance to inspect memory usage at two levels: buffer pool allocation per database, and memory distribution across internal SQL Server components.

Start with the buffer pool query to identify which database is the largest memory consumer. If a specific database is using a disproportionate amount, follow up with the memory clerks query to understand how SQL Server is distributing memory across its subsystems.

Before you perform high-risk operations, such as modifying the configurations or data of Alibaba Cloud instances, check the disaster recovery and fault tolerance capabilities of the instances to ensure data security.
Before you modify the configurations or data of an instance, such as an Elastic Compute Service (ECS) instance or an RDS instance, create snapshots or enable backup for the instance. For example, you can enable log backup for an RDS instance.
If you granted permissions on sensitive information or submitted sensitive information in the Alibaba Cloud Management Console, modify the sensitive information (such as usernames and passwords) at the earliest opportunity.

Prerequisites

Before you begin, ensure that you have:

View buffer pool usage by database

Run this query to see how much of the buffer pool each database is occupying, sorted from largest to smallest:

SELECT COUNT(*) * 8 / 1024 AS "Cache Size(MB)",
       CASE
           WHEN Database_ID = 32767 THEN 'ResourceDb'
           ELSE DB_NAME(Database_ID)
       END AS "Database"
FROM sys.dm_os_buffer_descriptors
GROUP BY DB_NAME(Database_ID),
         Database_ID
ORDER BY "Cache Size(MB)" DESC;

The result shows the buffer pool cache consumed by each database in MB. ResourceDb (Database_ID 32767) is the SQL Server internal system database.

Run this query first to identify which database is consuming the most memory. If one database accounts for a disproportionately large share, that is a useful starting point for further investigation.

View memory usage by component

Run this query to see how memory is distributed across internal SQL Server memory components (memory clerks):

SELECT * FROM sys.dm_os_memory_clerks;

Use this query to understand how SQL Server allocates memory across its subsystems — for example, whether the buffer pool, plan cache, or execution memory is the dominant consumer.

What's next

References